2026-07-08 11:00:06 +08:00
|
|
|
import { defineConfig } from 'tsdown'
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Package-shape override (see the root tsdown.config.ts): besides the
|
|
|
|
|
* default lib/index.js bundle, the worker BOOTSTRAP ships as its own
|
2026-07-13 20:55:47 +08:00
|
|
|
* sibling CommonJS entry — `new Worker(fileURLToPath(new URL('./worker.cjs', import.meta.url)))`
|
|
|
|
|
* loads it as a file, so it cannot be part of the index bundle. pkg's VFS
|
|
|
|
|
* Worker hook compiles string-path entries as CommonJS, so an ESM worker is
|
|
|
|
|
* not viable inside the executable. TWO
|
2026-07-08 12:55:14 +08:00
|
|
|
* single-entry builds, not one two-entry build: a multi-entry build emits
|
|
|
|
|
* the shared bootstrap module as a `lib/bootstrap-*.js` chunk both bundles
|
|
|
|
|
* import, which the package.json `files` whitelist (deliberately exact)
|
|
|
|
|
* would omit from the packed artifact — each single-entry build inlines its
|
|
|
|
|
* own bootstrap copy instead, keeping every shipped file self-contained.
|
2026-07-08 11:00:06 +08:00
|
|
|
*/
|
2026-07-08 12:55:14 +08:00
|
|
|
export default defineConfig([
|
|
|
|
|
{
|
|
|
|
|
entry: ['lib/types/index.js'],
|
|
|
|
|
outDir: 'lib',
|
|
|
|
|
format: ['esm'],
|
|
|
|
|
platform: 'node',
|
|
|
|
|
target: 'es2024',
|
|
|
|
|
fixedExtension: false,
|
|
|
|
|
dts: false,
|
|
|
|
|
clean: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
entry: ['lib/types/worker.js'],
|
|
|
|
|
outDir: 'lib',
|
2026-07-13 20:55:47 +08:00
|
|
|
format: ['cjs'],
|
2026-07-08 12:55:14 +08:00
|
|
|
platform: 'node',
|
|
|
|
|
target: 'es2024',
|
|
|
|
|
fixedExtension: false,
|
|
|
|
|
dts: false,
|
|
|
|
|
clean: false,
|
|
|
|
|
},
|
|
|
|
|
])
|