Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2075 votes
7 answers
310k views

NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. Webpack [closed]

I'm trying to summarize my knowledge about the most popular JavaScript package managers, bundlers, and task runners. Please correct me if I'm wrong: npm & bower are package managers. They just ...
VB_'s user avatar
  • 45.4k
366 votes
46 answers
574k views

Field 'browser' doesn't contain a valid alias configuration

I've started using webpack2 (to be precise, v2.3.2) and after re-creating my config I keep running into an issue I can't seem to solve I get (sorry in advance for ugly dump): ERROR in ./src/main.js ...
Matthew Herbst's user avatar
240 votes
14 answers
387k views

How to make the webpack dev server run on port 80 and on 0.0.0.0 to make it publicly accessible?

I am new to the whole nodejs/reactjs world so apologies if my question sounds silly. I am currently playing around with reactabular.js. Whenever I do a npm start it always runs on localhost:8080. How ...
90abyss's user avatar
  • 7,265
185 votes
26 answers
334k views

webpack is not recognized as a internal or external command,operable program or batch file

I am Learning React.js and i am using windows 8 OS.i have navigate to my root folder 1.Created the package.json file by npm init 2. install webpack by npm install -S webpack.now webpack has been ...
yasar 's user avatar
  • 2,761
166 votes
15 answers
420k views

npx command not found

I am working with webpack and I need to execute ./node_modules/webpack/bin/webpack.js using npx. npx webpack would run the webpack binary (./node_modules/webpack/bin/webpack), but each time I execute ...
wokoro douye samuel's user avatar
142 votes
15 answers
148k views

How to uninstall global package with npm?

I have installed webpack in this way: npm install -g webpack Now want to uninstall it: npm uninstall -g webpack Check it again, it didn't been uninstalled: webpack -v 3.1.0 Why? And, I use this ...
cloud_cloud's user avatar
  • 2,131
140 votes
12 answers
240k views

Webpack - webpack-dev-server: command not found

I am working on a React webapp using webpack, loosely alongside this tutorial. Accidentally, I added the node_modules folder to my git. I then removed it again using git rm -f node_modules/*. Now, ...
Jonas Kemper's user avatar
  • 3,875
131 votes
10 answers
182k views

Webpack 4 "size exceeds the recommended limit (244 KiB)"

I have two files which are combined under 600 bytes (.6kb) as below. So how is it that my app.bundle.js is so large (987kb) and more importantly how does one manage the size of it? src file index.js ...
Michael Nelles's user avatar
122 votes
8 answers
239k views

Webpack how to build production code and how to use it

I am very new to webpack, I found that in production build we can able to reduce the size of overall code. Currently webpack builds around 8MB files and main.js around 5MB. How to reduce the size of ...
Gilson PJ's user avatar
  • 3,529
114 votes
14 answers
193k views

Cannot find module '@babel/core'

I am following along with this webpack4/react tutorial: https://www.youtube.com/watch?v=deyxI-6C2u4 I have followed it exactly up until the part where he runs npm start. The difference is, his app ...
J. Doe's user avatar
  • 1,207
98 votes
4 answers
67k views

Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead

I see the following errors when trying to start my app... > [email protected] start /Users/johnnynolan/Repos/css-modules webpack && open index.html (node:5706) DeprecationWarning: ...
Drostan's user avatar
  • 1,839
92 votes
10 answers
73k views

How do I load font-awesome using SCSS (SASS) in Webpack using relative paths?

I have font-awesome in my node_modules folder so I try to import it in my main .scss file like so: @import "../../node_modules/font-awesome/scss/font-awesome.scss"; But Webpack bundling compilation ...
Richard's user avatar
  • 16.2k
91 votes
8 answers
260k views

"You may need an additional loader to handle the result of these loaders."

I am currently trying to build a State Management Library for ReactJs. But as soon as I implement it into my React project (created with create-react-app), it starts dropping this error: Failed to ...
BennoDev's user avatar
  • 1,247
85 votes
9 answers
238k views

webpack command not working

I am new to Node Js and Webpack. I tried to start a project with module-loaders. Firstly, I installed nodeJs and NPM and created a new directory called tutorial. I used the command prompt to cd into ...
Mohan's user avatar
  • 4,777
79 votes
16 answers
109k views

webpack: Cannot read property 'match' of undefined

I have installed webpack (Symfony encore) using npm as follows: sudo npm install -g @symfony/webpack-encore --save-dev I ran this from /var/www/project I was required to install globally due to ...
Alex.Barylski's user avatar
79 votes
6 answers
85k views

Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated

How can I solve this warning when creating laravel project? Steps to replicate: composer create-project --prefer-dist laravel/laravel example cd example composer require laravel/ui php artisan ui vue ...
rhemmuuu's user avatar
  • 1,187
78 votes
8 answers
64k views

path.js:1086 Error: ENOENT: no such file or directory, uv_cwd

I was following the Webpack guide and get stuck here while running npm run build I received the this error: path.js:1086 cwd = process.cwd(); ^ Error: ENOENT: no ...
Nedko Dimitrov's user avatar
77 votes
13 answers
394k views

webpack: Module not found: Error: Can't resolve (with relative path)

I have this structure of an app (node_modules dir excluded from this list): ├── actions.js ├── bundle.js ├── components │   ├── App.js │   ├── Footer.js │   ├── Link.js │   ├── Todo.js │   └── ...
Andrius's user avatar
  • 20.7k
75 votes
3 answers
120k views

How to import CSS from node_modules in webpack angular2 app

Let's say that we start with the following starter pack: https://github.com/angularclass/angular2-webpack-starter After npm install and npm run start everything works fine. I want to add an external ...
Burnee's user avatar
  • 2,583
74 votes
16 answers
141k views

Webpack 4 : ERROR in Entry module not found: Error: Can't resolve './src'

I was trying to run webpack-4 first time webpack ./src/js/app.js ./dist/app.bundle.js it shows warning / error : WARNING in configuration The 'mode' option has not been set, webpack will fallback ...
Sabir Hussain's user avatar
71 votes
5 answers
92k views

How to use normalize.css using npm install with webpack?

I am using webpack with ReactJS and trying to figure out how to using normalize.css after npm installing it (https://necolas.github.io/normalize.css/). Is the normalize.css applied right away after ...
Dan Me's user avatar
  • 2,163
68 votes
7 answers
233k views

Using "npm run build" fails with "npm ERR! missing script: build"

How can I fix this error, I'm running Windows 10 When i try to npm run build on the cmd i get this error C:\Users\anai_> npm run build npm ERR! missing script: build Here is the log of the run 0 ...
repeataftermewearefree's user avatar
64 votes
11 answers
79k views

Angular 6 many Can't resolve errors (crypto, fs, http, https, net, path, stream, tls, zlib)

I'm building an Angular 6 app, but every time I want to serve to localhost, I get these errors: ERROR in ./node_modules/aws-sign2/index.js Module not found: Error: Can't resolve 'crypto' in 'C:\...
Zizazorro's user avatar
  • 1,341
59 votes
6 answers
73k views

webpack-dev-server does not watch for my file changes

When I change my files while webpack-dev-server is running, the bundle's files are not updated. Here are my webpack.config.js and package.json files, as you can see from my npm script, I've solved ...
Jurgo Boemo's user avatar
  • 1,748
59 votes
8 answers
20k views

Using webpack aliases in mocha tests

I'm developing a web app at work in React/Redux/Webpack and am now starting to integrate testing with Mocha. I followed the instructions for writing tests in the Redux documentation, but now I have ...
Danny Delott's user avatar
  • 6,928
57 votes
4 answers
34k views

Get current `--mode` in webpack.config.js

How can I get the current --mode specified in package.json inside webpack.config.js? (For instance, for pushing some plugins.) package.json "scripts": { "dev": "webpack --...
xAoc's user avatar
  • 3,538
56 votes
11 answers
135k views

Module not found: Error: Can't resolve 'net' in 'node_modules/stompjs/lib'

Got an issue where a stompJS-lib was not found, upon which I got the following error message: Module not found: Error: Can't resolve 'net' in '/../../../.../../../angular-app/node_modules/stompjs/lib'...
S34N's user avatar
  • 8,181
55 votes
6 answers
44k views

Import from subfolder of npm package

I've been working on creating a small library of React components for use in several other projects. I am publishing the package internally (using a private GitHub repository) and then including in ...
Kendall's user avatar
  • 2,112
53 votes
4 answers
24k views

How to avoid React loading twice with Webpack when developing

Given the following directory structure: my-project | |-- node_modules | |-- react |-- module-x | |--node_modules | |--react You can see both my-...
chevin99's user avatar
  • 5,038
53 votes
9 answers
167k views

webpack imported module is not a constructor

I created a small JS module which I intend to make an npm package, but for now is just on GitHub. This module is written in ES6 and SCSS, and is thus relying on webpack and babel for transpilation. To ...
Liran H's user avatar
  • 10.1k
53 votes
7 answers
71k views

webpack warning - WARNING in DefinePlugin Conflicting values for 'process.env.NODE_ENV'

I'm getting the warning in the title when I try to run development mode. This script used to work fine for an earlier website but now I always get this warning. This is my package.json: { "name&...
Dan's user avatar
  • 767
52 votes
6 answers
93k views

"npm run" fails with ERR_OSSL_EVP_UNSUPPORTED

I have an existing project which I lately installed on a new equipment. It is a Laravel + vue project. When I run npm run watch I get the following error: > development > cross-env NODE_ENV=...
guyaloni's user avatar
  • 5,502
49 votes
1 answer
61k views

how to export and import style in npm package?

I have a React component and I publish the component in NPM registry that I build with webpack. In my main project I consumed the component npm package JS like that: import myComp from 'myComp'; The ...
David's user avatar
  • 1,382
48 votes
9 answers
146k views

Webpack command not found

I have installed webpack using npm install -g webpack and npm install webpack I also installed webpack-dev-server npm install -g webpack-dev-server After completion of installation, I ran ...
Bishnu Bhattarai's user avatar
47 votes
6 answers
28k views

How do I build a JSON file with webpack?

I'd like to assemble a manifest.json file, as used by Chrome extensions, in a "smarter," programmatic sort of way. I'm using npm for my dependency resolution, and its package.json includes some shared ...
user108471's user avatar
  • 2,587
42 votes
2 answers
81k views

How would I import a module within an npm package subfolder with webpack?

Lets say theres a package in node_modules called foo and I want to import a module within a library such as foo/module via webpack & babel... import Foo from 'foo'; works import SomeOtherModule ...
glued's user avatar
  • 2,609
41 votes
6 answers
62k views

Solve having more than one copy of React in the same app

I'm developing a React module locally. For that, I'm linking my module using npm link. The module is imported successfully but hooks are failing inside the module. It's throwing the following error: ...
Rashomon's user avatar
  • 6,612
40 votes
1 answer
29k views

Module build failed: ReferenceError: [BABEL]

I have this configuration package.json { "name": "app02", "version": "1.0.0", "description": "", "main": "webpack.config.js", "dependencies": { "react": "^0.14.3" }, "...
przbadu's user avatar
  • 5,969
40 votes
6 answers
42k views

Yarn, node-gyp rebuild compile error, node_modules/fsevents: Command failed

I am using Yarn to handle the packages. yarn install shows the error regardless of the package that I use but the install looked like it successfully finished and files are set under node-modules ...
whitebear's user avatar
  • 12k
36 votes
4 answers
10k views

How to solve "TypeError: process.getuid is not a function"

I am running react.js with laravel and watching changes with yarn run watch which has worked fine until I began to come across this error with webpack any time I used yarn or npm after I made some ...
kelvin's user avatar
  • 514
35 votes
6 answers
69k views

Laravel Mix unknown option '--hide-modules' error

When I try to compile React component with Laravel Mix in my Laravel project it raises error 2 lifecycle. E:\MY PROJECTS\Samriddhi Institute> npm run dev @ dev E:\MY PROJECTS\Samriddhi Institute ...
Ravi Majithiya's user avatar
35 votes
2 answers
19k views

Mocha tests don't run with Webpack and mocha-loader

Background I am porting some npm scripts to Webpack loaders to better learn how Webpack works and I’ve got everything working except for my Mocha tests: I have one failing test, but it is not showing ...
user avatar
35 votes
4 answers
23k views

With Webpack, is it possible to generate CSS only, excluding the output.js?

I'm using Webpack with the extract-text-webpack-plugin. In my project, I have some build scripts. One of the build scripts is supposed to bundle and minify CSS only. As I'm using Webpack for the ...
Andre Pena's user avatar
  • 58.5k
35 votes
4 answers
26k views

npm link with webpack - cannot find module

I'm trying to npm link a module to a project using webpack as its bundler. Of course, after trying many things, I keep getting this error: ERROR in ./src/components/store/TableView.jsx Module not ...
bmills's user avatar
  • 555
33 votes
1 answer
28k views

How can I setup webpack to minify and combine scss and javascript like CodeKit?

I'm having trouble using webpack instead of Codekit v1.9.3. I started working to move from CodeKit to Grunt and Gulp, and then learned about webpack which sounds very cool. I just can't seem to get it ...
cwd's user avatar
  • 54.2k
33 votes
3 answers
28k views

Difference between lib and dist folders when packaging library using webpack?

Ive just published my first package (a react component) to npm but im having some trouble understanding the difference between what the lib directory is compared to the dist. Currently I generate ...
Deep's user avatar
  • 3,046
31 votes
3 answers
89k views

sh: 1: rimraf: not found whenever I run npm run build within vagrant installed on Windows 10 or MacOS

I want to run a webpack project within Vagrant (installed on Windows 10) where I embedded a Ubuntu 16.04 virtual machine. I was able to install npm 5.6.0 and nodejs v8.9.4 very successfully. I ...
kabrice's user avatar
  • 1,625
30 votes
1 answer
35k views

Plugins[0][1] must be an object, false, or undefined

I have been trying to upgrade my packages and things have started to fall apart and I am now unable to build and cannot seem to figure out what is the issue. I suspect the issue is related to the ....
ComputerLocus's user avatar
29 votes
2 answers
74k views

How to exclude directory from getting bundled by Webpack?

Expected: When I build with webpack, all my JS files get bundled except for the files in the ./src/Portfolio directory as per my Webpack.config.js settings. Actual: Webpack bundles all the files ...
NewScientists's user avatar
29 votes
2 answers
13k views

Include assets from webpack bundled npm package

I've been banging my head over this for a while, and am wondering if it's even possible to begin with. Thanks for any help with this! The npm package I've got an npm package which is basically a ...
Johnny Copperstone's user avatar

1
2 3 4 5
53