diff --git a/templates/webpack.angular.js b/templates/webpack.angular.js index b32809fc..b7d950c0 100644 --- a/templates/webpack.angular.js +++ b/templates/webpack.angular.js @@ -60,7 +60,8 @@ module.exports = env => { const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`; const entryPath = `.${sep}${entryModule}`; const entries = { bundle: entryPath }; - if (platform === "ios") { + const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1); + if (platform === "ios" && !areCoreModulesExternal) { entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules"; }; diff --git a/templates/webpack.config.spec.ts b/templates/webpack.config.spec.ts index 2aba89f8..eced35fc 100644 --- a/templates/webpack.config.spec.ts +++ b/templates/webpack.config.spec.ts @@ -115,6 +115,20 @@ describe('webpack.config.js', () => { expect(isCalled).toBe(true, 'Webpack.config.js must use the getConvertedExternals method'); }); + if (platform === "ios") { + it('has inspector_modules entry when tns-core-modules are not externals', () => { + const input = getInput({ platform, externals: ['nativescript-vue'] }); + const config = webpackConfig(input); + expect(config.entry["tns_modules/tns-core-modules/inspector_modules"]).toEqual("inspector_modules"); + }); + + it('does not have inspector_modules entry when tns-core-modules are externals', () => { + const input = getInput({ platform, externals: ['tns-core-modules'] }); + const config = webpackConfig(input); + expect(config.entry["tns_modules/tns-core-modules/inspector_modules"]).toBeUndefined(); + }); + } + [ { input: ['nativescript-vue'], @@ -343,4 +357,4 @@ describe('webpack.config.js', () => { }); }); }); -}); +}); \ No newline at end of file diff --git a/templates/webpack.javascript.js b/templates/webpack.javascript.js index 070ff65a..105992d5 100644 --- a/templates/webpack.javascript.js +++ b/templates/webpack.javascript.js @@ -54,7 +54,8 @@ module.exports = env => { const entryModule = nsWebpack.getEntryModule(appFullPath, platform); const entryPath = `.${sep}${entryModule}.js`; const entries = { bundle: entryPath }; - if (platform === "ios") { + const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1); + if (platform === "ios" && !areCoreModulesExternal) { entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules"; }; diff --git a/templates/webpack.typescript.js b/templates/webpack.typescript.js index e3b75ff7..75efdc61 100644 --- a/templates/webpack.typescript.js +++ b/templates/webpack.typescript.js @@ -58,7 +58,8 @@ module.exports = env => { const tsConfigPath = resolve(projectRoot, "tsconfig.tns.json"); - if (platform === "ios") { + const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1); + if (platform === "ios" && !areCoreModulesExternal) { entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules"; }; diff --git a/templates/webpack.vue.js b/templates/webpack.vue.js index f0eb6e9e..5f8cbec4 100644 --- a/templates/webpack.vue.js +++ b/templates/webpack.vue.js @@ -61,7 +61,8 @@ module.exports = env => { const entryModule = nsWebpack.getEntryModule(appFullPath, platform); const entryPath = `.${sep}${entryModule}`; const entries = { bundle: entryPath }; - if (platform === "ios") { + const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1); + if (platform === "ios" && !areCoreModulesExternal) { entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules"; }; console.log(`Bundling application for entryPath ${entryPath}...`);