You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In webpack 3+, if you'd like to specify additional or different options for a loader, edit `config/webpack/environment.js` and provide an options object to override. This is similar to the technique shown above, but the following example shows specifically how to apply CSS Modules, which is what you may be looking for:
Originally, chunks (and modules imported inside them) were connected by a parent-child relationship in the internal webpack graph. The CommonsChunkPlugin was used to avoid duplicated dependencies across them, but further optimizations were not possible.
258
236
259
237
Since webpack v4, the CommonsChunkPlugin was removed in favor of optimization.splitChunks.
@@ -310,3 +288,28 @@ You can preload your assets with the `preload_pack_asset` helper if you have Rai
310
288
**Warning:** You don't want to preload the css, you want to preload the fonts and images inside the css so that fonts, css, and images can all be downloaded in parallel instead of waiting for the browser to parse the css.
311
289
312
290
More detailed guides available here: [webpack guides](https://webpack.js.org/guides/)
291
+
292
+
## Webpack Multi-Compiler and Server-Side Rendering
293
+
You can export an Array of Object to have both `bin/webpack` and `bin/webpack-dev-server`
294
+
use multiple configurations. This is commonly done for React server-side rendering (SSR).
295
+
296
+
For an example of this, see the configuration within the [`/config/webpack` dir of the React on Rails Example](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/config/webpack).
297
+
298
+
Take special care in that you need to make a deep copy of the output from the the basic "client" configuration.
299
+
300
+
In the example below, you _cannot_ modify the clientConfigObject as that would mutate the "environment" that is global.
0 commit comments