diff --git a/templates/webpack.angular.js b/templates/webpack.angular.js index 1267f6fd..aa1b9ee3 100644 --- a/templates/webpack.angular.js +++ b/templates/webpack.angular.js @@ -52,6 +52,7 @@ module.exports = env => { unitTesting, // --env.unitTesting } = env; + const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap; const externals = nsWebpack.getConvertedExternals(env.externals); const appFullPath = resolve(projectRoot, appPath); const appResourcesFullPath = resolve(projectRoot, appResourcesPath); @@ -93,7 +94,7 @@ module.exports = env => { mainPath: join(appFullPath, entryModule), tsConfigPath: join(__dirname, tsConfigName), skipCodeGeneration: !aot, - sourceMap: !!sourceMap, + sourceMap: !!isAnySourceMapEnabled, additionalLazyModuleResources: additionalLazyModuleResources }); @@ -168,10 +169,11 @@ module.exports = env => { new TerserPlugin({ parallel: true, cache: true, - sourceMap: !!sourceMap || !!hiddenSourceMap, + sourceMap: isAnySourceMapEnabled, terserOptions: { output: { comments: false, + semicolons: !isAnySourceMapEnabled }, compress: { // The Android SBG has problems parsing the output diff --git a/templates/webpack.config.spec.ts b/templates/webpack.config.spec.ts index 158807ff..155e7859 100644 --- a/templates/webpack.config.spec.ts +++ b/templates/webpack.config.spec.ts @@ -273,6 +273,7 @@ describe('webpack.config.js', () => { expect(config.devtool).toEqual("none"); expect(uglifyJsOptions.sourceMap).toBeFalsy(); + expect(uglifyJsOptions.terserOptions.output.semicolons).toBeTruthy(); expect(config.output.sourceMapFilename).toEqual("[file].map"); }); @@ -283,6 +284,7 @@ describe('webpack.config.js', () => { expect(config.devtool).toEqual("inline-source-map"); expect(uglifyJsOptions.sourceMap).toBeTruthy(); + expect(uglifyJsOptions.terserOptions.output.semicolons).toBeFalsy(); expect(config.output.sourceMapFilename).toEqual("[file].map"); }); }); @@ -300,6 +302,7 @@ describe('webpack.config.js', () => { expect(config.devtool).toEqual("none"); expect(uglifyJsOptions.sourceMap).toBeFalsy(); + expect(uglifyJsOptions.terserOptions.output.semicolons).toBeTruthy(); expect(config.output.sourceMapFilename).toEqual("[file].map"); }); @@ -310,6 +313,7 @@ describe('webpack.config.js', () => { expect(config.devtool).toEqual("hidden-source-map"); expect(uglifyJsOptions.sourceMap).toBeTruthy(); + expect(uglifyJsOptions.terserOptions.output.semicolons).toBeFalsy(); expect(config.output.sourceMapFilename).toEqual(join("..", "sourceMap", "[file].map")); }); @@ -320,6 +324,7 @@ describe('webpack.config.js', () => { expect(config.devtool).toEqual("hidden-source-map"); expect(uglifyJsOptions.sourceMap).toBeTruthy(); + expect(uglifyJsOptions.terserOptions.output.semicolons).toBeFalsy(); expect(config.output.sourceMapFilename).toEqual(join("..", "sourceMap", "[file].map")); }); @@ -331,6 +336,7 @@ describe('webpack.config.js', () => { expect(config.devtool).toEqual("hidden-source-map"); expect(uglifyJsOptions.sourceMap).toBeTruthy(); + expect(uglifyJsOptions.terserOptions.output.semicolons).toBeFalsy(); expect(config.output.sourceMapFilename).toEqual(join("..", newSourceMapFolder, "[file].map")); }); }); diff --git a/templates/webpack.javascript.js b/templates/webpack.javascript.js index 15609089..baf83484 100644 --- a/templates/webpack.javascript.js +++ b/templates/webpack.javascript.js @@ -45,8 +45,9 @@ module.exports = env => { hmr, // --env.hmr, unitTesting, // --env.unitTesting } = env; - const externals = nsWebpack.getConvertedExternals(env.externals); + const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap; + const externals = nsWebpack.getConvertedExternals(env.externals); const appFullPath = resolve(projectRoot, appPath); const appResourcesFullPath = resolve(projectRoot, appResourcesPath); @@ -129,10 +130,11 @@ module.exports = env => { new TerserPlugin({ parallel: true, cache: true, - sourceMap: !!sourceMap || !!hiddenSourceMap, + sourceMap: isAnySourceMapEnabled, terserOptions: { output: { comments: false, + semicolons: !isAnySourceMapEnabled }, compress: { // The Android SBG has problems parsing the output diff --git a/templates/webpack.typescript.js b/templates/webpack.typescript.js index b43eedde..01441718 100644 --- a/templates/webpack.typescript.js +++ b/templates/webpack.typescript.js @@ -45,6 +45,7 @@ module.exports = env => { hmr, // --env.hmr, unitTesting, // --env.unitTesting } = env; + const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap; const externals = nsWebpack.getConvertedExternals(env.externals); const appFullPath = resolve(projectRoot, appPath); @@ -131,10 +132,11 @@ module.exports = env => { new TerserPlugin({ parallel: true, cache: true, - sourceMap: !!sourceMap || !!hiddenSourceMap, + sourceMap: isAnySourceMapEnabled, terserOptions: { output: { comments: false, + semicolons: !isAnySourceMapEnabled }, compress: { // The Android SBG has problems parsing the output @@ -207,7 +209,7 @@ module.exports = env => { configFile: "tsconfig.tns.json", allowTsInNodeModules: true, compilerOptions: { - sourceMap + sourceMap: isAnySourceMapEnabled } }, } diff --git a/templates/webpack.vue.js b/templates/webpack.vue.js index ae399fc0..66f13fa3 100644 --- a/templates/webpack.vue.js +++ b/templates/webpack.vue.js @@ -50,6 +50,7 @@ module.exports = env => { unitTesting, // --env.unitTesting } = env; + const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap; const externals = nsWebpack.getConvertedExternals(env.externals); const mode = production ? "production" : "development" @@ -142,10 +143,11 @@ module.exports = env => { new TerserPlugin({ parallel: true, cache: true, - sourceMap: !!sourceMap || !!hiddenSourceMap, + sourceMap: isAnySourceMapEnabled, terserOptions: { output: { comments: false, + semicolons: !isAnySourceMapEnabled }, compress: { // The Android SBG has problems parsing the output