From accb7e30c38511531fcc512d8d4a683121e03191 Mon Sep 17 00:00:00 2001 From: sis0k0 Date: Wed, 25 Jul 2018 15:50:07 +0300 Subject: [PATCH] fix: define process as undefined This will prevent webpack from adding a polyfill for `process` (`process/browser.js`) whenever someone does `typeof process`. What will change: - process will be undefined instead of Object. - `typeof process === 'undefined'` will return true - Angular Animations won't assume the app is running in node context ([check](https://github.com/angular/angular/blob/d4ac9698ba7dd829600ca4c8129fcbeae9cb4bed/packages/animations/browser/src/render/shared.ts#L17)) and won't trigger logic which breaks {N} animations. ** Important ** This may break plugin which check if the `process` object is defined. fixes https://github.com/NativeScript/nativescript-angular/issues/1433 --- templates/webpack.angular.js | 1 + templates/webpack.javascript.js | 1 + templates/webpack.typescript.js | 1 + 3 files changed, 3 insertions(+) diff --git a/templates/webpack.angular.js b/templates/webpack.angular.js index 895ce298..144bcdf7 100644 --- a/templates/webpack.angular.js +++ b/templates/webpack.angular.js @@ -195,6 +195,7 @@ module.exports = env => { // Define useful constants like TNS_WEBPACK new webpack.DefinePlugin({ "global.TNS_WEBPACK": "true", + "process": undefined, }), // Remove all files from the out dir. new CleanWebpackPlugin([ `${dist}/**/*` ]), diff --git a/templates/webpack.javascript.js b/templates/webpack.javascript.js index 37251794..2795ee65 100644 --- a/templates/webpack.javascript.js +++ b/templates/webpack.javascript.js @@ -170,6 +170,7 @@ module.exports = env => { // Define useful constants like TNS_WEBPACK new webpack.DefinePlugin({ "global.TNS_WEBPACK": "true", + "process": undefined, }), // Remove all files from the out dir. new CleanWebpackPlugin([ `${dist}/**/*` ]), diff --git a/templates/webpack.typescript.js b/templates/webpack.typescript.js index 79ee37a5..a4053bdb 100644 --- a/templates/webpack.typescript.js +++ b/templates/webpack.typescript.js @@ -180,6 +180,7 @@ module.exports = env => { // Define useful constants like TNS_WEBPACK new webpack.DefinePlugin({ "global.TNS_WEBPACK": "true", + "process": undefined, }), // Remove all files from the out dir. new CleanWebpackPlugin([ `${dist}/**/*` ]),