make bundler more resilient to missing sources
This commit is contained in:
parent
4d9250e662
commit
1c6a988d27
2 changed files with 9 additions and 1 deletions
7
app.js
7
app.js
|
|
@ -196,8 +196,13 @@ function init(mod) {
|
|||
|
||||
if (alt) {
|
||||
for (let [ key, val ] of Object.entries(append)) {
|
||||
let src = `src/main/${key}.js`;
|
||||
if (!fs.existsSync(src)) {
|
||||
logger.log('missing:', src);
|
||||
continue;
|
||||
}
|
||||
fs.mkdirSync(`alt/main`, { recursive: true });
|
||||
let body = fs.readFileSync(`src/main/${key}.js`);
|
||||
let body = fs.readFileSync(src);
|
||||
fs.writeFileSync(`alt/main/${key}.js`, body + val);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ function* walk(dir, seen = new Set()) {
|
|||
if (excludes.indexOf(dir) >= 0) {
|
||||
return;
|
||||
}
|
||||
if (!fs.existsSync(dir)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const real = fs.realpathSync(dir);
|
||||
if (seen.has(real)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue