All Questions
5,677
questions
2225
votes
67
answers
2.8m
views
Error message "error:0308010C:digital envelope routines::unsupported"
I created the default IntelliJ IDEA React project and got this:
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (...
424
votes
37
answers
616k
views
How to Polyfill node core modules in webpack 5
webpack 5 no longer do auto-polyfilling for node core modules.
How to fix it please?
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer ...
271
votes
14
answers
287k
views
How to build minified and uncompressed bundle with webpack?
Here's my webpack.config.js
var webpack = require("webpack");
module.exports = {
entry: "./entry.js",
devtool: "source-map",
output: {
path: "./dist",
filename: "bundle.min.js"
},
...
239
votes
14
answers
381k
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 ...
236
votes
25
answers
481k
views
Error: Cannot find module 'webpack'
I'm just getting started with webpack and am having difficulty getting the multiple-entry-points sample to build. The webpack.config.js file in the example includes the line
var CommonsChunkPlugin =...
184
votes
8
answers
158k
views
How to get access to webpack-dev-server from devices in local network?
There is some webpack dev server config (it's part of the whole config):
config.devServer = {
contentBase: './' + (options.publicFolder ? options.publicFolder : 'public'),
stats: {
modules: ...
169
votes
5
answers
73k
views
Gulp + Webpack or JUST Webpack?
I see people using gulp with webpack. But then I read webpack can replace gulp? I'm completely confused here...can someone explain?
UPDATE
in the end I started with gulp. I was new to modern front-...
164
votes
15
answers
220k
views
Conflict: Multiple assets emit to the same filename
I'm a webpack rookie who wants to learn all about it.
I came across a conflict when running my webpack telling me:
ERROR in chunk html [entry] app.js Conflict: Multiple assets emit to
the same ...
163
votes
15
answers
397k
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 ...
140
votes
12
answers
237k
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, ...
137
votes
15
answers
141k
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 ...
134
votes
8
answers
263k
views
How to determine the installed webpack version
Especially during the transition from webpack v1 to v2, it would be important to programmatically determine what webpack version is installed, but I cannot seem to find the appropriate API.
128
votes
10
answers
177k
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
...
124
votes
17
answers
195k
views
Add Favicon with React and Webpack
I am attempting to add a favicon to a React-based website that I made using webpack. It has been a total nightmare to add a favicon and I have tried many solutions to no avail. The latest solution ...
122
votes
8
answers
237k
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 ...
117
votes
2
answers
39k
views
Webpack vs webpack-dev-server vs webpack-dev-middleware vs webpack-hot-middleware vs etc
I'm starting working with webpack with a node/express environment developing a ReactJS server side rendered application with react-router. I'm getting very confused about the role of each webpack ...
114
votes
14
answers
189k
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 ...
109
votes
9
answers
100k
views
How to set multiple file entry and output in project with webpack?
How to set multiple file entry/output in project with webpack?
I follow http://webpack.github.io/docs/tutorials/getting-started/ success compile if only one file in one entry/output...
directory
...
109
votes
4
answers
51k
views
Webpack-dev-server serves a directory list instead of the app page
I can only see the actual app under /public.
The configs in webpack.config.js are below:
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: [
'webpack-...
108
votes
14
answers
186k
views
Webpack: Bundle.js - Uncaught ReferenceError: process is not defined
Here's my webpack.config.js
"use strict";
module.exports = {
entry: ['./main.js'],
output: { path: __dirname, filename: 'bundle.js' },
module: {
loaders: [
{
...
107
votes
9
answers
101k
views
Babel 7 - ReferenceError: regeneratorRuntime is not defined
I have an application that is a node backend and a react frontend.
I get the following error when i try to build/run my node application.
Node: v10.13.0
Error:
dist/index.js:314
...
94
votes
15
answers
189k
views
Uncaught ReferenceError: Buffer is not defined
Our application kept showing the error in the title. The problem is very likely related to Webpack 5 polyfill and after going through a couple of solutions:
Setting fallback + install with npm
...
94
votes
10
answers
196k
views
Node cannot find module "fs" when using webpack
I'm using node.js and webpack to create a bundle. From what I've read, node.js should contain fs module for managing files. However when I call require("fs") I get an Cannot find module "fs" error. ...
94
votes
3
answers
63k
views
Webpack for back-end?
I was just wondering, I started using Webpack for a new project and so far it's working fine. I almost would say I like it better than Grunt, which I used before. But now I'm quite confused how and or ...
92
votes
10
answers
72k
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 ...
90
votes
8
answers
136k
views
Webpack 4 - create vendor chunk
In a webpack 3 configuration I would use the code below to create separate vendor.js chunk:
entry: {
client: ['./client.js'],
vendor: ['babel-polyfill', 'react', 'react-dom', 'redux'],
},
...
85
votes
2
answers
86k
views
ReferenceError: webpack is not defined
In my webpack app I have a basic build process that's triggered by "npm run build" which executes the webpack binary and copies my index.html in /app to /dist. Whenever I run npm run build I get ...
85
votes
8
answers
235k
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 ...
76
votes
6
answers
88k
views
Running a node express server using webpack-dev-server
I'm using webpack to run my react frontend successfully using the following config:
{
name: 'client',
entry: './scripts/main.js',
output: {
path: __dirname,
filename: '...
75
votes
8
answers
58k
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 ...
75
votes
19
answers
146k
views
How to fix "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" error
I'm trying to deploy a reactjs application to heroku. While compiling assets, the build fails and produces this error:
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby ...
74
votes
6
answers
75k
views
Error: Cannot find module 'webpack/lib/rules/DescriptionDataMatcherRulePlugin' Require stack:
I have webpack-cli installed on my laravel project. I don't know why first of all we need it to run my vue app but this is causing an error:
When I run npm run dev or npm run hot
[webpack-cli] Error: ...
73
votes
2
answers
54k
views
Using webpack with an existing PHP and JS project
I have an existing PHP project with jquery and bootstrap, not using any front-end framework.
I am trying to use webpack module bundler in order to create a single entry point for my project resources,...
71
votes
6
answers
105k
views
How can I use webpack with express?
When I try to use webpack with a simple express server I always get TONS of errors:
express.js
'use strict';
var express = require('express');
var path = require('path');
var url = require('url');
/...
67
votes
28
answers
115k
views
proxy not working for react and node
I'm having issues with the proxy I set up.
This is my root package.json file:
"scripts": {
"client": "cd client && yarn dev-server",
"server": "nodemon server.js",
"dev": "...
67
votes
9
answers
74k
views
An import path cannot end with '.ts' - NodeJS and Visual Code
I've got an error while trying to build a simple NodeJS app:
Even that Visual Code prompts an error, my code got running.. When I remove the .ts extension from import statement, I got an error that ...
66
votes
3
answers
37k
views
Webpack sass where is the css file
I am using web pack with sass loader like this:
module.exports = {
module: {
loaders: [
{
test: /\.scss$/,
loader: "style!css!sass"
}
]
}
};
But i see the ...
65
votes
9
answers
117k
views
Load fonts with Webpack and font-face
I'm trying to load a font in my CSS file using @font-face but the font never loads. This is my directory structure.
Then in webpack.config.js I have the loader to get fonts.
var path = require('path'...
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:\...
63
votes
6
answers
75k
views
How to add wildcard mapping in entry of webpack
I need to webpack all the js file in the script folder.I tried this
module.exports = {
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ["...
58
votes
6
answers
40k
views
Webpack Error - configuration.node has an unknown property 'fs'
I have encountered an error when using the latest version of Webpack (5.1.0). It looks like the configuration is throwing an error because the validation schema is too restrictive. Here is my webpack ...
57
votes
4
answers
33k
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 --...
56
votes
14
answers
70k
views
Karma/Jasmine times out without running tests
I'm trying to run Karma/Jasmine from Grunt on a project generated with
http://newtriks.com/2013/12/31/automating-react-with-yeoman-and-grunt/
Karma launches PhantomJS (or Chrome) and, depending on ...
56
votes
3
answers
113k
views
webpack-dev-server Cannot find module 'webpack'
I'm trying to use webpack-dev-server to run a simple program
but I'm getting this error:
module.js:471
throw err;
^
Error: Cannot find module 'webpack'
at Function.Module....
55
votes
6
answers
43k
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 ...
54
votes
2
answers
20k
views
How should I use moment-timezone with webpack?
In using webpack to build my project, I typically require modules in CommonJS from npm modules. I need moment-timezone in my project, however in building the package you must also build all the data ...
54
votes
1
answer
7k
views
In the `import` syntax of ES6, how is a module evaluated exactly?
Let's say we have four modules, A, B,C and D
In module A:
console.log("A evaluated")
function AClass {
console.log("A constructor")
}
var aObj = new AClass()
export default aObj;
In module B:
...
53
votes
3
answers
54k
views
Get Webpack not to bundle files
So right now I'm working with a prototype where we're using a combination between webpack (for building .tsx files and copying .html files) and webpack-dev-server for development serving. As you can ...
51
votes
2
answers
46k
views
webpack css-loader not finding images within url() reference in an external stylesheet
I'm new to the whole Node/NPM/Webpack world, so apologies if this is obvious.
I'm attempting to build a simple front-end project bundled with Webpack. I've got node installed, and have a package.json ...
50
votes
6
answers
22k
views
Webpack TypeScript module.hot does not exist
I want to enable Webpack HMR in a NodeJS project written in TypeScript.
But module.hot is not available:
@types/webpack-env defines:
declare var module: __WebpackModuleApi.Module
Which conflicts ...