So I'm currently working on a microfrontend setup for an Angular project. When trying to create a bundle of polyfills, es5 scripts etc to be shared among the different projects, the directory being created has backslashes for some reason causing the path not to be found. If these were forward slashes they would work fine, Ideas?
const fs = require('fs-extra');
const concat = require('concat');
(async function build(){
const prgName = process.argv.slice(2)[0];
if(prgName === '' || prgName === undefined){
console.log("Project name is required as an argument");
}else{
const files_es2015 = [
'./dist/' + prgName + '/polyfill-webcomp-es5.js',
'./dist/' + prgName + '/polyfill-webcomp.js',
'./dist/' + prgName + '/polyfill-es2015.js',
'./dist/' + prgName + '/scripts.js',
'./dist/' + prgName + '/main-es2015.js',
]
await fs.ensureDir('./dist/' + prgName + '/elements');
await concat(files_es2015,'./dist/' + prgName + '/elements/' + prgName + '-elements-es2015.js');
const files_es5 = [
'./dist/' + prgName + '/polyfill-webcomp-es5.js',
'./dist/' + prgName + '/polyfill-webcomp.js',
'./dist/' + prgName + '/polyfill-es2015.js',
'./dist/' + prgName + '/scripts.js',
'./dist/' + prgName + '/main-es5.js',
]
await fs.ensureDir('./dist/' + prgName + '/elements');
await concat(files_es2015,'./dist/' + prgName + '/elements/' + prgName + '-elements-es5.js');
console.log('Done generating bundles for ' + prgName);
}
})()
This will output the following message when trying to create the build
(node:26344) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'C:\Code\Project\Code Testing\project-UI-Workspace\dist\classroomApp\polyfill-es2015.js'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:26344) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:26344) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Folder setup, view from the project-UI-workspace folder. This is after running the script so you can see the elements folder gets created but nothing goes in due to bad path.
