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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NativeScript/nativescript-dev-webpack
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.20.2
Choose a base ref
...
head repository: NativeScript/nativescript-dev-webpack
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.20.3
Choose a head ref
  • 8 commits
  • 14 files changed
  • 6 contributors

Commits on Feb 20, 2019

  1. chore: bump ng dependencies version (#805)

    Bump ng dependencies version to sync with nativescript-angular.
    manoldonev authored Feb 20, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ae75255 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bf1cc33 View commit details
  3. fix(HMR): modulePath on Windows to apply changes in app styles at run…

    …time (#807)
    
    * fix(HMR): modulePath on Windows
    
    Replace backslashes with forward slashes.
    
    * refactor: rename a method
    vchimev authored Feb 20, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    cc55d4f View commit details

Commits on Feb 21, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d1345f2 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ba6d896 View commit details

Commits on Feb 22, 2019

  1. Copy the full SHA
    70cd58a View commit details

Commits on Mar 11, 2019

  1. fix: show message for stopping webpack only when it has been started (#…

    …821)
    
    Currently the message `Stopping webpack watch` is printed whenever CLI executes `after-watch` hooks, i.e. when user runs `tns run <platform>` and sends Ctrl+C, the message is shown. However, we have not started any webpack process, so there's nothing to stop.
    Print the message only when webpack process had been started. Also print it only when `--log trace` is used.
    rosen-vladimirov authored Mar 11, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1bd18e5 View commit details

Commits on Mar 14, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    968551b View commit details
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
<a name="0.20.3"></a>
## [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))



<a name="0.20.1"></a>
## [0.20.1](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.20.0...0.20.1) (2019-02-18)

4 changes: 2 additions & 2 deletions dependencyManager.js
Original file line number Diff line number Diff line change
@@ -84,11 +84,11 @@ function getRequiredDeps(packageJson) {
}

const deps = {
"@angular/compiler-cli": "~7.1.0",
"@angular/compiler-cli": "~7.2.0",
};

if (!dependsOn(packageJson, "@angular-devkit/build-angular")) {
deps["@ngtools/webpack"] = "~7.1.0";
deps["@ngtools/webpack"] = "~7.2.0";
}

return deps;
3 changes: 1 addition & 2 deletions lib/after-watch.js
Original file line number Diff line number Diff line change
@@ -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");
}
4 changes: 2 additions & 2 deletions lib/before-watch.js
Original file line number Diff line number Diff line change
@@ -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 => {
10 changes: 6 additions & 4 deletions lib/compiler.js
Original file line number Diff line number Diff line change
@@ -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,9 +171,11 @@ function logSnapshotWarningMessage($logger) {
}
}

function stopWebpackForPlatform(platform) {
function stopWebpackForPlatform($logger, platform) {
$logger.trace(`Stopping webpack watch for platform ${platform}.`);
const webpackProcess = webpackProcesses[platform];
webpackProcess.kill("SIGINT");

delete webpackProcesses[platform];
}

9 changes: 6 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
const os = require("os");
const path = require("path");

const {
getAppPathFromProjectData,
getAppResourcesPathFromProjectData,
getProjectDir,
isAndroid,
} = require("../projectHelpers");

@@ -92,12 +90,17 @@ function removeListener(eventEmitter, name) {
}
}

function convertToUnixPath(relativePath) {
return relativePath.replace(/\\/g, "/");
}

module.exports = {
buildEnvData,
debuggingEnabled,
shouldSnapshot,
getUpdatedEmittedFiles,
parseHotUpdateChunkName,
addListener,
removeListener
removeListener,
convertToUnixPath
};
4 changes: 3 additions & 1 deletion markup-hot-loader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const { reload } = require("./hot-loader-helper");
const { convertToUnixPath } = require("./lib/utils");

module.exports = function (source) {
const typeMarkup = "markup";
const modulePath = this.resourcePath.replace(this.rootContext, ".");
const moduleRelativePath = this.resourcePath.replace(this.rootContext, ".");
const modulePath = convertToUnixPath(moduleRelativePath);
return `${source};${reload({ type: typeMarkup, path: modulePath })}`;
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-dev-webpack",
"version": "0.20.1",
"version": "0.20.3",
"main": "index",
"description": "",
"homepage": "http://www.telerik.com",
4 changes: 3 additions & 1 deletion script-hot-loader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const { reload } = require("./hot-loader-helper");
const { convertToUnixPath } = require("./lib/utils");

module.exports = function (source) {
const typeScript = "script";
const modulePath = this.resourcePath.replace(this.rootContext, ".");
const moduleRelativePath = this.resourcePath.replace(this.rootContext, ".");
const modulePath = convertToUnixPath(moduleRelativePath);
return `${source};${reload({ type: typeScript, path: modulePath })}`;
};
4 changes: 3 additions & 1 deletion style-hot-loader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const { reload } = require("./hot-loader-helper");
const { convertToUnixPath } = require("./lib/utils");

module.exports = function (source) {
const typeStyle = "style";
const modulePath = this.resourcePath.replace(this.rootContext, ".");
const moduleRelativePath = this.resourcePath.replace(this.rootContext, ".");
const modulePath = convertToUnixPath(moduleRelativePath);
return `${source};${reload({ type: typeStyle, path: modulePath })}`;
};
2 changes: 2 additions & 0 deletions templates/webpack.angular.js
Original file line number Diff line number Diff line change
@@ -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.
@@ -109,6 +110,7 @@ module.exports = env => {
libraryTarget: "commonjs2",
filename: "[name].js",
globalObject: "global",
hashSalt
},
resolve: {
extensions: [".ts", ".js", ".scss", ".css"],
2 changes: 2 additions & 0 deletions templates/webpack.javascript.js
Original file line number Diff line number Diff line change
@@ -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.
@@ -71,6 +72,7 @@ module.exports = env => {
libraryTarget: "commonjs2",
filename: "[name].js",
globalObject: "global",
hashSalt
},
resolve: {
extensions: [".js", ".scss", ".css"],
2 changes: 2 additions & 0 deletions templates/webpack.typescript.js
Original file line number Diff line number Diff line change
@@ -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.
@@ -71,6 +72,7 @@ module.exports = env => {
libraryTarget: "commonjs2",
filename: "[name].js",
globalObject: "global",
hashSalt
},
resolve: {
extensions: [".ts", ".js", ".scss", ".css"],
5 changes: 4 additions & 1 deletion templates/webpack.vue.js
Original file line number Diff line number Diff line change
@@ -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);
@@ -79,6 +81,7 @@ module.exports = env => {
libraryTarget: "commonjs2",
filename: "[name].js",
globalObject: "global",
hashSalt
},
resolve: {
extensions: [".vue", ".ts", ".js", ".scss", ".css"],
@@ -109,7 +112,7 @@ module.exports = env => {
"fs": "empty",
"__dirname": false,
},
devtool: "none",
devtool: sourceMap ? "inline-source-map" : "none",
optimization: {
splitChunks: {
cacheGroups: {