From 17c49e60b367868c80f44b9921793dc3a2d9adaa Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 May 2018 17:08:31 +0200 Subject: [PATCH] Add patch for angular cli 6 --- client/angular-cli-patch.js | 15 +++++++++++++++ client/angular.json | 5 +++-- client/package.json | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 client/angular-cli-patch.js diff --git a/client/angular-cli-patch.js b/client/angular-cli-patch.js new file mode 100644 index 000000000..0829631c2 --- /dev/null +++ b/client/angular-cli-patch.js @@ -0,0 +1,15 @@ +// Remove patch when https://github.com/angular/angular-cli/issues/10681#issuecomment-389160125 is closed + +const fs = require('fs'); +const f = 'node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js'; + +fs.readFile(f, 'utf8', function (err,data) { + if (err) { + return console.log(err); + } + var result = data.replace(/node: false/g, 'node: { global: true, crypto: "empty", fs: "empty", process: true, module: false, clearImmediate: false, setImmediate: false }'); + + fs.writeFile(f, result, 'utf8', function (err) { + if (err) return console.log(err); + }); +}); diff --git a/client/angular.json b/client/angular.json index 4a03d7cfe..4f7f7e72b 100644 --- a/client/angular.json +++ b/client/angular.json @@ -11,6 +11,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { + "deployUrl": "client/", "outputPath": "dist", "index": "src/index.html", "main": "src/main.ts", @@ -41,7 +42,7 @@ "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, - "serviceWorker": true, + "serviceWorker": false, "ngswConfigPath": "/src/ngsw-config.json", "fileReplacements": [ { @@ -136,4 +137,4 @@ "prefix": "app" } } -} \ No newline at end of file +} diff --git a/client/package.json b/client/package.json index cd975dd0b..58ce7f65d 100644 --- a/client/package.json +++ b/client/package.json @@ -17,7 +17,7 @@ "webpack": "webpack", "tslint": "tslint", "ng": "ng", - "postinstall": "npm rebuild node-sass", + "postinstall": "npm rebuild node-sass && node angular-cli-patch.js", "webpack-bundle-analyzer": "webpack-bundle-analyzer" }, "license": "GPLv3", -- 2.25.1