Search code examples
webpackassetswebpack-dev-server

Not compiling assets when using webpack-dev-server


This is my project configuration:

"webpack": "^4.16.5",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.5"

When I run npx webpack --config webpack.config.js everything is running as expected - all of the assets are compiled and assets folder is created.

When I run webpack-dev-server command only a server is started, the assets are compiled, but the assets folder is not created.


Solution

  • The assets folder is not created because webpack-dev-server or webpack-dev-middleware creates all your bundler in memory. This means that the browser is going to access the content served from the memory by webpack-dev-server.

    When you directly run webpack, that creates actual files. Nothing is wrong here.