Skip to main content

All Questions

140 votes
8 answers
84k views

webpack can't find module if file named jsx

As I write webpack.config.js like this module.exports = { entry: './index.jsx', output: { filename: 'bundle.js' }, module: { loaders: [{ test: /\.jsx?$/, exclude: /...
qiuyuntao's user avatar
  • 2,364
240 votes
14 answers
388k 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,263
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
17 votes
2 answers
62k views

Module not found: Error: Cannot resolve module 'fs'

I'm making a react app using Babel and Webpack and I want to use the file-exists package from npm. I already installed and saved the package as a dependency for my project. After running npm start I ...
Jorge Eduardo Sosa's user avatar
18 votes
6 answers
19k views

Console logging error on bundle.js instead of React component

I have created a Webpack build which works fine for me - it has a dev-server which I use for hot-reloading, and a production express server that runs a template html file and integrates the bundle.js ...
Paulos3000's user avatar
  • 3,505
81 votes
5 answers
163k views

webpack dev server CORS issue

I am using webpack-dev-server v1.10.1 to boost up my Redux project and I have the options below: contentBase: `http://${config.HOST}:${config.PORT}`, quiet: false, noInfo: true, hot: true, inline: ...
Hao's user avatar
  • 1,544
37 votes
2 answers
37k views

How to configure webpack dev server with react router dom v4?

This is the code of my webpack configuration: const compiler = webpack({ entry: ['whatwg-fetch', path.resolve(__dirname, 'js', 'app.js')], module: { loaders: [ { exclude: /...
gpbaculio's user avatar
  • 5,910
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
30 votes
4 answers
92k views

Content not from webpack is served from /foo

I just can't start this server, I read the webpack-dev-server docs. devServer: { contentBase: path.join(__dirname, "dist"), compress: true, port: 9000 } The sample code looks simple,but I just ...
McGrady's user avatar
  • 11.3k
51 votes
3 answers
52k views

Difference between production and development build in ReactJS

Recently I started learning react and I saw a tutorial where they used Webpack to create the production and development builds. But there was no explanation on what the difference between those two ...
Blinxen's user avatar
  • 856
20 votes
5 answers
41k views

Webpack + Babel: Couldn't find preset "es2015" relative to directory

I have a React project using Webpack and Babel. When I created it on an office computer, the Webpack ran fine. When I cloned the project onto my personal computer, it gave the following error: ERROR ...
Louis Cruz's user avatar
  • 1,673
10 votes
3 answers
3k views

nested url routing using react-router and webpack dev server

I'm having some issues working with react-router and webpack-dev-server to achieve nested url routing. webpack.config.js output: { path: path.resolve(__dirname, 'build'), publicPath: "/", &...
Bruce Lim's user avatar
  • 755
8 votes
5 answers
7k views

React Router v4 nested routes not work with webpack-dev-server

I try to setup nested routes for my react app like this / -> Home Page /about -> About Page /protected -> protected default page /protected/page1 -> protected page 1 It works fine in codesandbox (...
Bing Lu's user avatar
  • 3,382
7 votes
5 answers
18k views

Webpack 5 Receiving a Polyfill Error?!?! My JavaScript React project is receiving a polyfill error while trying to compile my webpack.config.js file

I am taking a course on Udemy (it is Brad Schiff's React for the Rest of Us course here) that is based on React and I am receiving an error related to webpack which is keeping it from compiling. I am ...
ThisIsShayan's user avatar
3 votes
2 answers
3k views

HookWebpackError: Cannot read properties of undefined (reading 'e') -- inner error -- TypeError: Cannot read properties of undefined (reading 'e')

I use npx-create-react-app years, but now i can't build with run npm run build. Today still is work. I update node and npm. Clear the cahce with: npm cache clean --force None of the projects work. ...
Milán Nikolics's user avatar

15 30 50 per page
1
2 3 4 5