Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 1d4b071

Browse files
committed
fix(inspector_modules): Switch to single runtime chunk
The default setting causes the WebPack runtime to be loaded twice because the `inspector_modules` module is loaded by the iOS runtime as a secondary entry point. This has some undesirable implications as [stated in the documentation](https://webpack.js.org/configuration/optimization/#optimizationruntimechunk): > Imported modules are initialized for each runtime chunk separately, > so if you include multiple entry points on a page, beware of this > behavior. You will probably want to set it to single or use another > configuration that allows you to only have one runtime instance.
1 parent 00ecaa0 commit 1d4b071

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

templates/webpack.angular.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ module.exports = env => {
140140
},
141141
devtool: sourceMap ? "inline-source-map" : "none",
142142
optimization: {
143+
runtimeChunk: "single",
143144
splitChunks: {
144145
cacheGroups: {
145146
vendor: {
@@ -258,6 +259,7 @@ module.exports = env => {
258259
], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
259260
// Generate a bundle starter script and activate it in package.json
260261
new nsWebpack.GenerateBundleStarterPlugin([
262+
"./runtime",
261263
"./vendor",
262264
"./bundle",
263265
]),

templates/webpack.javascript.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ module.exports = env => {
100100
"__dirname": false,
101101
},
102102
devtool: sourceMap ? "inline-source-map" : "none",
103-
optimization: {
103+
optimization: {
104+
runtimeChunk: "single",
104105
splitChunks: {
105106
cacheGroups: {
106107
vendor: {
@@ -210,6 +211,7 @@ module.exports = env => {
210211
], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
211212
// Generate a bundle starter script and activate it in package.json
212213
new nsWebpack.GenerateBundleStarterPlugin([
214+
"./runtime",
213215
"./vendor",
214216
"./bundle",
215217
]),

templates/webpack.typescript.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ module.exports = env => {
102102
"__dirname": false,
103103
},
104104
devtool: sourceMap ? "inline-source-map" : "none",
105-
optimization: {
105+
optimization: {
106+
runtimeChunk: "single",
106107
splitChunks: {
107108
cacheGroups: {
108109
vendor: {
@@ -223,6 +224,7 @@ module.exports = env => {
223224
], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
224225
// Generate a bundle starter script and activate it in package.json
225226
new nsWebpack.GenerateBundleStarterPlugin([
227+
"./runtime",
226228
"./vendor",
227229
"./bundle",
228230
]),

templates/webpack.vue.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ module.exports = env => {
113113
},
114114
devtool: "none",
115115
optimization: {
116+
runtimeChunk: "single",
116117
splitChunks: {
117118
cacheGroups: {
118119
vendor: {
@@ -230,6 +231,7 @@ module.exports = env => {
230231
], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
231232
// Generate a bundle starter script and activate it in package.json
232233
new nsWebpack.GenerateBundleStarterPlugin([
234+
"./runtime",
233235
"./vendor",
234236
"./bundle",
235237
]),

0 commit comments

Comments
 (0)