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

Commit fc4e415

Browse files
author
Dimitar Tachev
authored
Merge pull request #936 from NativeScript/tachev/preview-ios-inspector
fix: do not add inspector_modules entry when core modules are an external module
2 parents e2fbcc6 + e0cd8c1 commit fc4e415

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

Diff for: templates/webpack.angular.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ module.exports = env => {
6060
const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`;
6161
const entryPath = `.${sep}${entryModule}`;
6262
const entries = { bundle: entryPath };
63-
if (platform === "ios") {
63+
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1);
64+
if (platform === "ios" && !areCoreModulesExternal) {
6465
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules";
6566
};
6667

Diff for: templates/webpack.config.spec.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,20 @@ describe('webpack.config.js', () => {
115115
expect(isCalled).toBe(true, 'Webpack.config.js must use the getConvertedExternals method');
116116
});
117117

118+
if (platform === "ios") {
119+
it('has inspector_modules entry when tns-core-modules are not externals', () => {
120+
const input = getInput({ platform, externals: ['nativescript-vue'] });
121+
const config = webpackConfig(input);
122+
expect(config.entry["tns_modules/tns-core-modules/inspector_modules"]).toEqual("inspector_modules");
123+
});
124+
125+
it('does not have inspector_modules entry when tns-core-modules are externals', () => {
126+
const input = getInput({ platform, externals: ['tns-core-modules'] });
127+
const config = webpackConfig(input);
128+
expect(config.entry["tns_modules/tns-core-modules/inspector_modules"]).toBeUndefined();
129+
});
130+
}
131+
118132
[
119133
{
120134
input: ['nativescript-vue'],
@@ -343,4 +357,4 @@ describe('webpack.config.js', () => {
343357
});
344358
});
345359
});
346-
});
360+
});

Diff for: templates/webpack.javascript.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ module.exports = env => {
5454
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
5555
const entryPath = `.${sep}${entryModule}.js`;
5656
const entries = { bundle: entryPath };
57-
if (platform === "ios") {
57+
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1);
58+
if (platform === "ios" && !areCoreModulesExternal) {
5859
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules";
5960
};
6061

Diff for: templates/webpack.typescript.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ module.exports = env => {
5858

5959
const tsConfigPath = resolve(projectRoot, "tsconfig.tns.json");
6060

61-
if (platform === "ios") {
61+
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1);
62+
if (platform === "ios" && !areCoreModulesExternal) {
6263
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules";
6364
};
6465

Diff for: templates/webpack.vue.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ module.exports = env => {
6161
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
6262
const entryPath = `.${sep}${entryModule}`;
6363
const entries = { bundle: entryPath };
64-
if (platform === "ios") {
64+
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1);
65+
if (platform === "ios" && !areCoreModulesExternal) {
6566
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules";
6667
};
6768
console.log(`Bundling application for entryPath ${entryPath}...`);

0 commit comments

Comments
 (0)