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

fix: do not add inspector_modules entry when core modules are an external module #936

Merged
merged 1 commit into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion templates/webpack.angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};

Expand Down
16 changes: 15 additions & 1 deletion templates/webpack.config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -343,4 +357,4 @@ describe('webpack.config.js', () => {
});
});
});
});
});
3 changes: 2 additions & 1 deletion templates/webpack.javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};

Expand Down
3 changes: 2 additions & 1 deletion templates/webpack.typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};

Expand Down
3 changes: 2 additions & 1 deletion templates/webpack.vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}...`);
Expand Down