fix: add missing await on mkdir and node:module external in esbuild config
- Add await to fs.mkdir() call in generateDevices() (line 60). Without this, writeFile can race ahead of directory creation, causing ENOENT on clean builds or slower machines. - Add 'node:module' to the externals array. Node.js treats 'module' and 'node:module' as distinct specifiers; esbuild fails to resolve the prefixed form when bundling for the browser target. Discovered during Docker builds on ARM64 where the race window is wider due to slower I/O. Also reproduces on x86_64 with a clean src/pack/.
This commit is contained in:
parent
a678925d42
commit
6ba7507938
1 changed files with 2 additions and 1 deletions
|
|
@ -57,7 +57,7 @@ async function generateDevices(dir = '') {
|
|||
}
|
||||
}
|
||||
let dstr = JSON.stringify(devs);
|
||||
fs.mkdir(path.join(dir, "src", "pack"), { recursive: true });
|
||||
await fs.mkdir(path.join(dir, "src", "pack"), { recursive: true });
|
||||
await fs.writeFile(path.join(dir, "src", "pack", "kiri-devs.js"), `export const devices = ${dstr};`);
|
||||
if (true) {
|
||||
// create alt artifacts
|
||||
|
|
@ -77,6 +77,7 @@ const rec = {
|
|||
define: { 'process.env.NODE_ENV': `"${mode}"` },
|
||||
external: [
|
||||
'module',
|
||||
'node:module',
|
||||
'./constants',
|
||||
'./voronoi_structures',
|
||||
'./voronoi_ctypes',
|
||||
|
|
|
|||
Loading…
Reference in a new issue