diff --git a/CHANGELOG.md b/CHANGELOG.md index 693e7c43..9717065a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ + +## [0.20.3](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.20.2...0.20.3) (2019-03-14) + + +### Bug Fixes + +* initial compilation always generates same compilation hash ([#815](https://github.com/NativeScript/nativescript-dev-webpack/issues/815)) ([ba6d896](https://github.com/NativeScript/nativescript-dev-webpack/commit/ba6d896)) +* show message for stopping webpack only when it has been started ([#821](https://github.com/NativeScript/nativescript-dev-webpack/issues/821)) ([1bd18e5](https://github.com/NativeScript/nativescript-dev-webpack/commit/1bd18e5)) +* **HMR:** modulePath on Windows to apply changes in app styles at runtime ([#807](https://github.com/NativeScript/nativescript-dev-webpack/issues/807)) ([cc55d4f](https://github.com/NativeScript/nativescript-dev-webpack/commit/cc55d4f)) + + +### Features + +* **Vue:** option to enable sourcemaps ([#774](https://github.com/NativeScript/nativescript-dev-webpack/issues/774)) ([70cd58a](https://github.com/NativeScript/nativescript-dev-webpack/commit/70cd58a)) + + + ## [0.20.1](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.20.0...0.20.1) (2019-02-18) diff --git a/lib/after-watch.js b/lib/after-watch.js index 421f748d..85e8cb20 100644 --- a/lib/after-watch.js +++ b/lib/after-watch.js @@ -2,8 +2,7 @@ const { stopWebpackCompiler } = require('./compiler'); const { removeListener } = require("./utils"); module.exports = function($logger, $liveSyncService) { - $logger.info("Stopping webpack watch"); - stopWebpackCompiler(); + stopWebpackCompiler($logger); removeListener($liveSyncService, "liveSyncStopped"); removeListener(process, "exit"); } diff --git a/lib/before-watch.js b/lib/before-watch.js index 5d65310f..84ba260d 100644 --- a/lib/before-watch.js +++ b/lib/before-watch.js @@ -10,11 +10,11 @@ module.exports = function ($logger, $liveSyncService, $devicesService, hookArgs) Object.keys(webpackProcesses).forEach(platform => { const devices = $devicesService.getDevicesForPlatform(platform); if (!devices || !devices.length) { - stopWebpackCompiler(platform); + stopWebpackCompiler($logger, platform); } }); }); - addListener(process, "exit", stopWebpackCompiler); + addListener(process, "exit", () => stopWebpackCompiler($logger)); const platforms = hookArgs.config.platforms; return Promise.all(platforms.map(platform => { diff --git a/lib/compiler.js b/lib/compiler.js index 0dd35c11..588edc5d 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -123,11 +123,11 @@ exports.runWebpackCompiler = function runWebpackCompiler(config, $projectData, $ } } -exports.stopWebpackCompiler = function stopWebpackCompiler(platform) { +exports.stopWebpackCompiler = function stopWebpackCompiler($logger, platform) { if (platform) { - stopWebpackForPlatform(platform); + stopWebpackForPlatform($logger, platform); } else { - Object.keys(webpackProcesses).forEach(platform => stopWebpackForPlatform(platform)); + Object.keys(webpackProcesses).forEach(platform => stopWebpackForPlatform($logger, platform)); } } @@ -171,7 +171,8 @@ function logSnapshotWarningMessage($logger) { } } -function stopWebpackForPlatform(platform) { +function stopWebpackForPlatform($logger, platform) { + $logger.trace(`Stopping webpack watch for platform ${platform}.`); const webpackProcess = webpackProcesses[platform]; if (webpackProcess) { webpackProcess.kill("SIGINT"); diff --git a/templates/webpack.angular.js b/templates/webpack.angular.js index a10d2b96..d0babd02 100644 --- a/templates/webpack.angular.js +++ b/templates/webpack.angular.js @@ -13,6 +13,7 @@ const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); const { AngularCompilerPlugin } = require("@ngtools/webpack"); +const hashSalt = Date.now().toString(); module.exports = env => { // Add your custom Activities, Services and other Android app components here. @@ -112,6 +113,7 @@ module.exports = env => { libraryTarget: "commonjs2", filename: "[name].js", globalObject: "global", + hashSalt }, resolve: { extensions: [".ts", ".js", ".scss", ".css"], diff --git a/templates/webpack.javascript.js b/templates/webpack.javascript.js index c98cdad7..6ddda324 100644 --- a/templates/webpack.javascript.js +++ b/templates/webpack.javascript.js @@ -8,6 +8,7 @@ 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 hashSalt = Date.now().toString(); module.exports = env => { // Add your custom Activities, Services and other android app components here. @@ -73,6 +74,7 @@ module.exports = env => { libraryTarget: "commonjs2", filename: "[name].js", globalObject: "global", + hashSalt }, resolve: { extensions: [".js", ".scss", ".css"], diff --git a/templates/webpack.typescript.js b/templates/webpack.typescript.js index ec088514..42485d03 100644 --- a/templates/webpack.typescript.js +++ b/templates/webpack.typescript.js @@ -8,6 +8,7 @@ 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 hashSalt = Date.now().toString(); module.exports = env => { // Add your custom Activities, Services and other Android app components here. @@ -73,6 +74,7 @@ module.exports = env => { libraryTarget: "commonjs2", filename: "[name].js", globalObject: "global", + hashSalt }, resolve: { extensions: [".ts", ".js", ".scss", ".css"], diff --git a/templates/webpack.vue.js b/templates/webpack.vue.js index 4ad892d3..559fce76 100644 --- a/templates/webpack.vue.js +++ b/templates/webpack.vue.js @@ -12,6 +12,7 @@ const NsVueTemplateCompiler = require("nativescript-vue-template-compiler"); const nsWebpack = require("nativescript-dev-webpack"); const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target"); const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); +const hashSalt = Date.now().toString(); module.exports = env => { // Add your custom Activities, Services and other android app components here. @@ -44,6 +45,7 @@ module.exports = env => { production, // --env.production report, // --env.report hmr, // --env.hmr + sourceMap, // --env.sourceMap } = env; const externals = nsWebpack.getConvertedExternals(env.externals); @@ -81,6 +83,7 @@ module.exports = env => { libraryTarget: "commonjs2", filename: "[name].js", globalObject: "global", + hashSalt }, resolve: { extensions: [".vue", ".ts", ".js", ".scss", ".css"], @@ -111,7 +114,7 @@ module.exports = env => { "fs": "empty", "__dirname": false, }, - devtool: "none", + devtool: sourceMap ? "inline-source-map" : "none", optimization: { runtimeChunk: "single", splitChunks: {