build system
build.mjs runs two esbuild.build calls. Script: "build": "node build.mjs".
Config#
const commonConfig = {
entryPoints: ["src/index.js"],
bundle: true,
format: "esm",
sourcemap: true,
target: ["es2020"],
};
flowchart TB ep[entry src/index.js] --> bundle[bundle true] bundle --> fmt[format esm] fmt --> tgt[target es2020] tgt --> maps[sourcemap true]
No plugins, no externals, no banner. esbuild walks the static imports from index.js. feedback.js is not in that graph, so it is absent from the bundle unless you import it yourself.
Two outputs#
flowchart LR c[commonConfig] --> a[outfile dist/jsjiit.min.esm.js minify true] c --> b[outfile dist/jsjiit.esm.js minify false]
They run in sequence in one build() function. Either failure process.exit(1).
Console on success:
✅ Production build complete
✅ Development build complete
🎉 All builds completed successfully!
Source maps#
flowchart LR js[dist/*.esm.js] --> map[*.esm.js.map] map --> src[src/*.js]
sourcemap: true writes sibling .map files. DevTools can show wrapper.js line numbers.
When it runs#
flowchart TD manual[npm run build] --> dist[dist/] install[npm install in this repo] --> prepare[prepare] prepare --> dist publish[npm publish] --> prepare
End users of the published package do not run build.mjs. They already have dist/ in the tarball.
esbuild is 0.24.0 (exact) in devDependencies.