Add patch for angular cli 6
authorChocobozzz <me@florianbigard.com>
Tue, 15 May 2018 15:08:31 +0000 (17:08 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 16 May 2018 07:42:56 +0000 (09:42 +0200)
client/angular-cli-patch.js [new file with mode: 0644]
client/angular.json
client/package.json

diff --git a/client/angular-cli-patch.js b/client/angular-cli-patch.js
new file mode 100644 (file)
index 0000000..0829631
--- /dev/null
@@ -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);
+  });
+});
index 4a03d7cfed9995e72a35191d25c0bb491c648525..4f7f7e72bc7da9b413eb2b33feea2c2e61ca4d9d 100644 (file)
@@ -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": [
                 {
       "prefix": "app"
     }
   }
-}
\ No newline at end of file
+}
index cd975dd0bc0937e4edcf01b16d5bc37a9e708661..58ce7f65dedbbc3c5f4756243aba9fbc84910370 100644 (file)
@@ -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",