When I insert angular build scripts with document.createElement('script')
angular instances double. It works when there are more than one build. You can see it in the sandbox console: there are four console.log()
.
Here is my build script:
const fs = require('fs-extra');
const concat = require('concat');
const uniqueName = app-c;
const uniqueComponentPath = ./dist/app/${uniqueName}.js;
(async function build() {
const files = [
'./dist/app/runtime.js',
'./dist/app/polyfills.js',
'./dist/app/main.js'
].filter((x) => fs.pathExistsSync(x));
await fs.ensureFile(uniqueComponentPath);
await concat(files, uniqueComponentPath);
})();
"build": "ng build --output-hashing none && node build.js"