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) {
|
if (alt) {
|
||||||
for (let [ key, val ] of Object.entries(append)) {
|
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 });
|
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);
|
fs.writeFileSync(`alt/main/${key}.js`, body + val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ function* walk(dir, seen = new Set()) {
|
||||||
if (excludes.indexOf(dir) >= 0) {
|
if (excludes.indexOf(dir) >= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!fs.existsSync(dir)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const real = fs.realpathSync(dir);
|
const real = fs.realpathSync(dir);
|
||||||
if (seen.has(real)) {
|
if (seen.has(real)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue