Questions tagged [webpack-dev-server]

a Node.js based server that supports live reloading and is used for development of webpack powered applications.

webpack-dev-server is a little Node.js Express server, which uses the webpack-dev-middleware to serve a webpack bundle. It also has a little runtime which is connected to the server via Socket.IO. The server emits information about the compilation state to the client, which reacts to those events by updating the bundle.

The server is used for development purpose only.

3256 questions
16
votes
1 answer

Difference between publicPath and contentBase in webpack

I started using webpack and now confused between the publicPath and contentBase. The documentation isn't clear on the use case.
Nikhil
  • 665
  • 2
  • 11
  • 25
16
votes
1 answer

Use service workers with Webpack dev-server inside Docker container

I'm trying to use service workers inside a web app using Webpack and Docker. Everything I made for the moment is working well (service worker, webpack config, worker registration...) Actually my app is running inside a Docker container, in this…
Jérôme
  • 1,966
  • 4
  • 24
  • 48
16
votes
2 answers

Nodejs won't set cookie for React CRA application even with proxy

I have a nodejs/express + React CRA application, and I'm trying to set a cookie from nodejs. The server is on port 4001, so in my React application's project.json I have "proxy": "http://localhost:4001" set, but the cookie still won't get set in the…
chrispytoes
  • 1,714
  • 1
  • 20
  • 53
16
votes
2 answers

webpack-cli@3.0.8 requires a peer of webpack@^4.x.x but none is installed

Having a little trouble with React. Does anyone know how I can install the peer of webpack@^4.x.x? This is the error I am recieving when I try to run webpack-dev-server in cmd. It just returns webpack-cli@3.0.8 requires a peer of webpack@^4.x.x…
Allan
  • 351
  • 1
  • 2
  • 11
16
votes
2 answers

How can I fix these SockJS ssl errors?

With vue-cli 3, I've got a vue app whirring away in development mode. I call npm run serve, and I see... DONE Compiled successfully in 431ms …
bbsimonbb
  • 27,056
  • 15
  • 80
  • 110
16
votes
1 answer

WDS: Disconnected! loop when running webpack-dev-server simultaneously

Here is my use case. Several instances of webpack-dev-servers, running simultaneously on shared server everyone is serving content on its one port. At some point, every site falls into [WDS] Disconnected! loop. It's not clear to me where's the…
16
votes
3 answers

webpack-dev-server not working Cannot find module '../lib/polyfills'

I moved my project to another computer, ran npm install. Project works fine except webpack-dev-server, it throws error module.js:544 throw err; ^ Error: Cannot find module '../lib/polyfills' at Function.Module._resolveFilename…
Alexey K
  • 6,537
  • 18
  • 60
  • 118
16
votes
3 answers

How to add a js file with webpack?

I was reading this webpack tutorial: https://webpack.github.io/docs/usage.html It says it bundles the src files and node_modules. If I want to add another .js file there, how can I do this? This is a thirdpartyjs file that is not part of the source…
bier hier
  • 20,970
  • 42
  • 97
  • 166
16
votes
1 answer

React + Webpack HMR is refreshing the page (not hot loading)

I'm having a bit of trouble getting the react-hot webpack loader to work correctly. When I load the page I get the following as I would expect: [HMR] Waiting for update signal from WDS... [WDS] Hot Module Replacement enabled. But when I save a…
undefined
  • 33,537
  • 22
  • 129
  • 198
15
votes
3 answers

webpack-dev-server Disconnect and Trying to reconnect... spam

I just finished an angular project I was working on, but i noticed something in the console, which I'd love to hide if that's possible just to keep everything tidy. It's the [webpack-dev-server] module constantly disconnecting and trying to…
Reda Boi
  • 161
  • 1
  • 3
15
votes
2 answers

Webpack 4 devtool option does not work with webpack-dev-server

Before I decided to post this issue, I did quite a few things as a background check. So, my problem is: - I use webpack v4.6.0 and webpack-dev-server v3.1.3 - they work fine together, but now I am trying to set up source maps for my application, it…
margarita
  • 884
  • 1
  • 10
  • 21
15
votes
2 answers

How is webpack-serve different from webpack-dev-server?

webpack-serve: https://github.com/webpack-contrib/webpack-serve webpack-dev-server: https://github.com/webpack/webpack-dev-server They both state they're a dev server for webpack. How are they different?
serverpunk
  • 10,665
  • 15
  • 61
  • 95
15
votes
1 answer

How to completely remove webpack and all its dependencies from Rails App

I created my rails with this template that included webpack, I still write my javascript code in app/assets/javascript. I am trying to deploy my app to heroku and it keeps failing, I get this error "remote: …
Hakeem Baba
  • 647
  • 1
  • 12
  • 32
15
votes
1 answer

What is the difference between watchOptions.ignored and webpack.WatchIgnorePlugin

When using webpack with watch, such as when using webpack-dev-server there seem to be (at least) two different ways of excluding files from watching. I can't really find any documentation on the difference between these two configurations and why…
oBusk
  • 852
  • 2
  • 10
  • 21
15
votes
2 answers

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 get this error: ERROR in…
Jorge Eduardo Sosa
  • 155
  • 1
  • 1
  • 7