From 1ebc0d1e3371c77852715f135d6517cf7de36991 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 1 Nov 2017 12:05:11 +0100 Subject: [PATCH] revert: build(aio): remove cli patches (#19702) This reverts commit f0d530b4de38f71c759e42afc8f3d7531eb1b1fb. cli rc.8 reintroduces the node polyfill which causes size regression, so I'm putting the patch back in. -rw-r--r-- 1 iminar eng 14880 Nov 1 12:11 dist/0.b19e913fbdd6507d346b.chunk.js -rw-r--r-- 1 iminar eng 1533 Nov 1 12:11 dist/inline.25600c3b48de18b97581.bundle.js -rw-r--r-- 1 iminar eng 486476 Nov 1 12:11 dist/main.d1292a34401056535884.bundle.js -rw-r--r-- 1 iminar eng 37070 Nov 1 12:11 dist/polyfills.0dfca732c5a075c110d0.bundle.js PR Close #19702 --- aio/package.json | 2 +- aio/tools/cli-patches/patch.js | 10 ++++++++++ aio/tools/cli-patches/webpack-no-global.patch | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 aio/tools/cli-patches/patch.js create mode 100644 aio/tools/cli-patches/webpack-no-global.patch diff --git a/aio/package.json b/aio/package.json index cd36a49a25..df1dd6b674 100644 --- a/aio/package.json +++ b/aio/package.json @@ -52,7 +52,7 @@ "generate-zips": "node ./tools/example-zipper/generateZips", "sw-manifest": "ngu-sw-manifest --dist dist --in ngsw-manifest.json --out dist/ngsw-manifest.json", "sw-copy": "cp node_modules/@angular/service-worker/bundles/worker-basic.min.js dist/", - "postinstall": "uglifyjs node_modules/lunr/lunr.js -c -m -o src/assets/js/lunr.min.js --source-map", + "postinstall": "node tools/cli-patches/patch.js && uglifyjs node_modules/lunr/lunr.js -c -m -o src/assets/js/lunr.min.js --source-map", "build-ie-polyfills": "node node_modules/webpack/bin/webpack.js -p src/ie-polyfills.js src/generated/ie-polyfills.min.js", "~~check-env": "node scripts/check-environment", "~~build": "ng build --target=production --environment=stable -sm --build-optimizer", diff --git a/aio/tools/cli-patches/patch.js b/aio/tools/cli-patches/patch.js new file mode 100644 index 0000000000..259d688d9e --- /dev/null +++ b/aio/tools/cli-patches/patch.js @@ -0,0 +1,10 @@ +const fs = require('fs'); +const sh = require('shelljs'); + +const PATCH_LOCK = 'node_modules/@angular/cli/models/webpack-configs/.patched'; + +if (!fs.existsSync(PATCH_LOCK)) { + sh.exec('patch -p0 -i tools/cli-patches/webpack-no-global.patch'); + sh.touch(PATCH_LOCK); +} + diff --git a/aio/tools/cli-patches/webpack-no-global.patch b/aio/tools/cli-patches/webpack-no-global.patch new file mode 100644 index 0000000000..32969ac6e4 --- /dev/null +++ b/aio/tools/cli-patches/webpack-no-global.patch @@ -0,0 +1,16 @@ +--- node_modules/@angular/cli/models/webpack-configs/browser.js 2017-11-01 12:07:56.000000000 +0100 ++++ node_modules/@angular/cli/models/webpack-configs/browser.js 2017-11-01 12:08:12.000000000 +0100 +@@ -104,11 +104,11 @@ + ].concat(extraPlugins), + node: { + fs: 'empty', +- global: true, ++ global: false, + crypto: 'empty', + tls: 'empty', + net: 'empty', +- process: true, ++ process: false, + module: false, + clearImmediate: false, + setImmediate: false