From ea23ce67b43f271f085995aed082d1c875889555 Mon Sep 17 00:00:00 2001 From: sis0k0 Date: Wed, 10 Jan 2018 18:10:10 +0200 Subject: [PATCH] chore: update to ng5.1 and webpack 0.9.1 --- package.json | 33 +++++++++++++++++---------------- webpack.config.js | 29 ++++++++++++++++++++++------- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 982eee5a..e0cc4cad 100644 --- a/package.json +++ b/package.json @@ -29,14 +29,14 @@ } }, "dependencies": { - "@angular/common": "~5.0.0", - "@angular/compiler": "~5.0.0", - "@angular/core": "~5.0.0", - "@angular/forms": "~5.0.0", - "@angular/http": "~5.0.0", - "@angular/platform-browser": "~5.0.0", - "@angular/platform-browser-dynamic": "~5.0.0", - "@angular/router": "~5.0.0", + "@angular/common": "~5.1.0", + "@angular/compiler": "~5.1.0", + "@angular/core": "~5.1.0", + "@angular/forms": "~5.1.0", + "@angular/http": "~5.1.0", + "@angular/platform-browser": "~5.1.0", + "@angular/platform-browser-dynamic": "~5.1.0", + "@angular/router": "~5.1.0", "nativescript-angular": "next", "nativescript-camera": "~3.1.2", "nativescript-geolocation": "^4.1.1", @@ -48,15 +48,15 @@ "zone.js": "^0.8.4" }, "devDependencies": { - "@angular/compiler-cli": "~5.0.0", - "@ngtools/webpack": "~1.8.2", + "@angular/compiler-cli": "~5.1.0", + "@ngtools/webpack": "~1.9.1", "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.10.0", "codelyzer": "^3.0.1", - "copy-webpack-plugin": "~4.0.1", + "copy-webpack-plugin": "~4.3.0", "css-loader": "~0.28.7", - "extract-text-webpack-plugin": "~3.0.0", + "extract-text-webpack-plugin": "~3.0.2", "fs-extra": "^0.30.0", "glob": "^7.1.2", "lazy": "1.0.11", @@ -67,15 +67,16 @@ "nativescript-worker-loader": "~0.8.1", "opener": "^1.4.1", "raw-loader": "~0.5.1", - "resolve-url-loader": "~2.1.0", + "resolve-url-loader": "~2.2.1", "rimraf": "^2.5.3", "tar.gz": "^1.0.5", "tns-platform-declarations": "^3.3.0", "tslint": "^5.4.2", "typescript": "~2.4.2", - "webpack": "~3.8.1", - "webpack-bundle-analyzer": "^2.8.2", - "webpack-sources": "~1.0.1" + "webpack": "~3.10.0", + "webpack-bundle-analyzer": "^2.9.1", + "webpack-sources": "~1.1.0", + "uglifyjs-webpack-plugin": "~1.1.6" }, "scripts": { "pretsc": "npm install", diff --git a/webpack.config.js b/webpack.config.js index c87d0198..56434bcb 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -7,6 +7,7 @@ const CopyWebpackPlugin = require("copy-webpack-plugin"); const ExtractTextPlugin = require("extract-text-webpack-plugin"); const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); +const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); module.exports = env => { const platform = env && (env.android && "android" || env.ios && "ios"); @@ -60,12 +61,24 @@ module.exports = env => { { test: /\.html$|\.xml$/, use: "raw-loader" }, // tns-core-modules reads the app.css and its imports using css-loader - { test: /\/app\.css$/, use: "css-loader?url=false" }, - { test: /\/app\.scss$/, use: ["css-loader?url=false", "sass-loader"] }, + { + test: /[\/|\\]app\.css$/, + use: { + loader: "css-loader", + options: { minimize: false, url: false }, + } + }, + { + test: /[\/|\\]app\.scss$/, + use: [ + { loader: "css-loader", options: { minimize: false, url: false } }, + "sass-loader" + ] + }, // Angular components reference css files and their imports using raw-loader - { test: /\.css$/, exclude: /\/app\.css$/, use: "raw-loader" }, - { test: /\.scss$/, exclude: /\/app\.scss$/, use: ["raw-loader", "resolve-url-loader", "sass-loader"] }, + { test: /\.css$/, exclude: /[\/|\\]app\.css$/, use: "raw-loader" }, + { test: /\.scss$/, exclude: /[\/|\\]app\.scss$/, use: ["raw-loader", "resolve-url-loader", "sass-loader"] }, // Compile TypeScript files with ahead-of-time compiler. { test: /.ts$/, use: [ @@ -139,9 +152,11 @@ module.exports = env => { // Work around an Android issue by setting compress = false const compress = platform !== "android"; - config.plugins.push(new webpack.optimize.UglifyJsPlugin({ - mangle: { except: nsWebpack.uglifyMangleExcludes }, - compress, + config.plugins.push(new UglifyJsPlugin({ + uglifyOptions: { + mangle: { reserved: nsWebpack.uglifyMangleExcludes }, + compress, + } })); } return config;