diff --git a/package.json b/package.json index cf6f415..5d42525 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,7 @@ "readme": "NativeScript Application", "repository": "", "nativescript": { - "id": "org.nativescript.curiosity", - "tns-android": { - "version": "5.3.1" - } + "id": "org.nativescript.curiosity" }, "dependencies": { "@angular/animations": "~7.2.0", @@ -28,7 +25,7 @@ "nativescript-theme-core": "^1.0.4", "nativescript-ui-sidedrawer": "^6.0.0", "reflect-metadata": "~0.1.13", - "rxjs": "^6.4.0", + "rxjs": "^6.3.3", "tns-core-modules": "next", "zone.js": "^0.8.4" }, @@ -47,7 +44,7 @@ "nativescript-dev-webpack": "next", "tns-platform-declarations": "~5.3.1", "tslint": "^5.11.0", - "typescript": "3.1.1" + "typescript": "~3.1.1" }, "scripts": { "tslint": "tslint -p tsconfig.json", diff --git a/webpack.config.js b/webpack.config.js index 7fa0018..bd1ad9f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -11,7 +11,7 @@ const CleanWebpackPlugin = require("clean-webpack-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin"); const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); -const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); +const TerserPlugin = require("terser-webpack-plugin"); const { getAngularCompilerPlugin } = require("nativescript-dev-webpack/plugins/NativeScriptAngularCompilerPlugin"); const hashSalt = Date.now().toString(); @@ -47,10 +47,12 @@ module.exports = env => { uglify, // --env.uglify report, // --env.report sourceMap, // --env.sourceMap + hiddenSourceMap, // --env.hiddenSourceMap hmr, // --env.hmr, unitTesting, // --env.unitTesting } = env; + const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap; const externals = nsWebpack.getConvertedExternals(env.externals); const appFullPath = resolve(projectRoot, appPath); const appResourcesFullPath = resolve(projectRoot, appResourcesPath); @@ -89,13 +91,15 @@ module.exports = env => { const ngCompilerPlugin = new AngularCompilerPlugin({ hostReplacementPaths: nsWebpack.getResolver([platform, "tns"]), platformTransformers: ngCompilerTransformers.map(t => t(() => ngCompilerPlugin, resolve(appFullPath, entryModule))), - mainPath: resolve(appPath, entryModule), + mainPath: join(appFullPath, entryModule), tsConfigPath: join(__dirname, tsConfigName), skipCodeGeneration: !aot, - sourceMap: !!sourceMap, + sourceMap: !!isAnySourceMapEnabled, additionalLazyModuleResources: additionalLazyModuleResources }); + let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist); + const config = { mode: uglify ? "production" : "development", context: appFullPath, @@ -112,6 +116,7 @@ module.exports = env => { output: { pathinfo: false, path: dist, + sourceMapFilename, libraryTarget: "commonjs2", filename: "[name].js", globalObject: "global", @@ -142,7 +147,7 @@ module.exports = env => { "fs": "empty", "__dirname": false, }, - devtool: sourceMap ? "inline-source-map" : "none", + devtool: hiddenSourceMap ? "hidden-source-map" : (sourceMap ? "inline-source-map" : "none"), optimization: { runtimeChunk: "single", splitChunks: { @@ -161,13 +166,14 @@ module.exports = env => { }, minimize: !!uglify, minimizer: [ - new UglifyJsPlugin({ + new TerserPlugin({ parallel: true, cache: true, - sourceMap: !!sourceMap, - uglifyOptions: { + sourceMap: isAnySourceMapEnabled, + terserOptions: { output: { comments: false, + semicolons: !isAnySourceMapEnabled }, compress: { // The Android SBG has problems parsing the output @@ -253,7 +259,7 @@ module.exports = env => { new CleanWebpackPlugin([`${dist}/**/*`]), // Copy assets to out dir. Add your own globs as needed. new CopyWebpackPlugin([ - { from: { glob: "settings.json"} }, + { from: { glob: "settings.json"} }, // HERE { from: { glob: "fonts/**" } }, { from: { glob: "**/*.jpg" } }, { from: { glob: "**/*.png" } },