format: 'cjs',
...(isDevelopmentBuild && {
dir: './lib',
+ entryFileNames: '[name].cjs',
+ chunkFileNames: '[name]-[hash].cjs',
preserveModules: true,
preserveModulesRoot: './src'
}),
...(!isDevelopmentBuild && {
- file: './lib/index.js',
+ file: './lib/index.cjs',
plugins: [terser({ maxWorkers })]
}),
...(sourcemap && {
})
}
],
- external: [
- 'node:async_hooks',
- 'node:cluster',
- 'node:crypto',
- 'node:events',
- 'node:fs',
- 'node:os',
- 'node:perf_hooks',
- 'node:worker_threads'
- ],
+ external: [/^node:*/],
plugins: [
typescript({
- tsconfig: './tsconfig.build.json'
+ tsconfig: './tsconfig.build.json',
+ compilerOptions: {
+ sourceMap: sourcemap
+ }
}),
del({
targets: ['./lib/*']
}),
- isAnalyzeBuild && analyze(),
- isDocumentationBuild && command('pnpm typedoc')
+ Boolean(isAnalyzeBuild) && analyze(),
+ Boolean(isDocumentationBuild) && command('pnpm typedoc')
]
},
{
input: './lib/dts/index.d.ts',
output: [{ format: 'esm', file: './lib/index.d.ts' }],
- external: [
- 'node:async_hooks',
- 'node:cluster',
- 'node:events',
- 'node:perf_hooks',
- 'node:worker_threads'
- ],
+ external: [/^node:*/],
plugins: [
dts(),
del({
targets: ['./lib/dts'],
hook: 'buildEnd'
}),
- isAnalyzeBuild && analyze()
+ Boolean(isAnalyzeBuild) && analyze()
]
}
])