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
@@ -685,41 +713,21 @@ You can follow same steps for Angular too.
685
713
686
714
The CommonsChunkPlugin is an opt-in feature that creates a separate file (known as a chunk), consisting of common modules shared between multiple entry points. By separating common modules from bundles, the resulting chunked file can be loaded once initially, and stored in the cache for later use. This results in page speed optimizations as the browser can quickly serve the shared code from the cache, rather than being forced to load a larger bundle whenever a new page is visited.
687
715
688
-
Create a `app-config.js` file inside `config/webpack` and in that file add:
716
+
Add the plugins in `config/webpack/environment.js`:
689
717
690
718
```js
691
-
module.exports= {
692
-
plugins: [
693
-
// Creates a common vendor.js with all shared modules
694
-
newwebpack.optimize.CommonsChunkPlugin({
695
-
name:'vendor',
696
-
minChunks: (module) => {
697
-
// this assumes your vendor imports exist in the node_modules directory
We suggest you don't directly overwrite the provided configuration files
1103
-
and extend instead for smoother upgrades. Here is one way to do it:
1104
-
1105
-
Create a `app-config.js` file inside `config/webpack`, and in that add:
1106
-
1107
-
```js
1108
-
module.exports= {
1109
-
production: {
1110
-
plugins: [
1111
-
// ... Add plugins
1112
-
]
1113
-
},
1114
-
1115
-
development: {
1116
-
output: {
1117
-
// ... Custom output path
1118
-
}
1119
-
}
1120
-
}
1121
-
```
1122
-
1123
-
```js
1124
-
// config/webpack/production.js
1125
-
1126
-
const { plugins } =require('./app-config.js')
1127
-
1128
-
plugins:appConfig.plugins.concat([
1129
-
1130
-
// ...existing plugins
1131
-
1132
-
])
1133
-
```
1134
-
1135
-
But this could be done million other ways.
1136
-
1137
-
1138
1057
## Deployment
1139
1058
1140
1059
Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which gets run whenever you run `assets:precompile`. If you are not using sprockets you
0 commit comments