-
Notifications
You must be signed in to change notification settings - Fork 1
/
postinstall-web.js
29 lines (25 loc) · 984 Bytes
/
postinstall-web.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Allow angular using electron module (native node modules)
const fs = require('fs');
const f_angular = 'node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js';
const f_systemjs = 'node_modules/systemjs/dist/system.js';
fs.readFile(f_angular, 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
var result = data.replace(/target: "electron-renderer",/g, '');
var result = result.replace(/target: "web",/g, '');
var result = result.replace(/return \{/g, 'return {target: "web",');
fs.writeFile(f_angular, result, 'utf8', function (err) {
if (err) return console.log(err);
});
});
// Fix : [DEP0005] DeprecationWarning: Buffer()
fs.readFile(f_systemjs, 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
var result = data.replace(/new Buffer/g, 'Buffer.from');
fs.writeFile(f_systemjs, result, 'utf8', function (err) {
if (err) return console.log(err);
});
});