In webpack's getting started page, under the section about webpack-dev-server
it mentions -
The dev server uses webpack’s watch mode. It also prevents webpack from emitting the resulting files to disk. Instead it keeps and serves the resulting files from memory.
Does this mean that the bundled file webpack-dev-server
compiles is only kept in memory, and I have to also leave webpack --watch
running in the background along with the dev-server process to actually save the compiled file to my hard drive?
webpack-dev-server is Webpack's officially supported CLI-based tool for starting a static server for your assets. While you don't need any CLI tools to use Webpack, webpack-dev-server gives you a single command that starts a static server with built-in live reload.
Using this config webpack-dev-server will serve the static files in your public folder. It'll watch your source files for changes and when changes are made the bundle will be recompiled. This modified bundle is served from memory at the relative path specified in publicPath (see API).
To answer your specific question, the webpack configuration is stored wherever your global node_modules are installed; on Windows this is typically %AppData%\Roaming\npm\node_modules\powerbi-visuals-tools\lib\webpack.
Webpack Dev Middleware is middleware which can be mounted in an express server to serve the latest compilation of your bundle during development. This uses webpack 's Node API in watch mode and instead of outputting to the file system it outputs to memory.
webpack-dev-server
apparently does not compile your code to disk, but rather keeps it in memory. This means you need to either manually compile your changes, or run webpack --watch
in the background as you make changes if you want the changes reflected in your compiled file. I learned the hard way.
After digging a little deeper into the webpack-dev-server docs:
This modified bundle is served from memory at the relative path specified in publicPath (see API). It will not be written to your configured output directory. Where a bundle already exists at the same URL path, the bundle in memory takes precedence (by default).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With