diff --git a/src/content/guides/development.mdx b/src/content/guides/development.mdx index d2d511ad5ebf..9d3eb00e684c 100644 --- a/src/content/guides/development.mdx +++ b/src/content/guides/development.mdx @@ -16,6 +16,7 @@ contributors: - chenxsan - maxloh - snitin315 + - f3ndot --- T> This guide extends on code examples found in the [Output Management](/guides/output-management) guide. @@ -225,11 +226,16 @@ Change your configuration file to tell the dev server where to look for files: path: path.resolve(__dirname, 'dist'), clean: true, }, ++ optimization: { ++ runtimeChunk: 'single', ++ }, }; ``` This tells `webpack-dev-server` to serve the files from the `dist` directory on `localhost:8080`. +T> The `optimization.runtimeChunk: 'single'` was added because in this example we have more than one entrypoint on a single HTML page. Without this, we could get into trouble described [here](https://bundlers.tooling.report/code-splitting/multi-entry/). Read the [Code Splitting](/guides/code-splitting/) chapter for more details. + T> `webpack-dev-server` serves bundled files from the directory defined in [`output.path`](/configuration/output/#outputpath), i.e., files will be available under `http://[devServer.host]:[devServer.port]/[output.publicPath]/[output.filename]`. W> webpack-dev-server doesn't write any output files after compiling. Instead, it keeps bundle files in memory and serves them as if they were real files mounted at the server's root path. If your page expects to find the bundle files on a different path, you can change this with the [`devMiddleware.publicPath`](/configuration/dev-server/#devserverdevmiddleware) option in the dev server's configuration.