chore(scripts): improve build config
This commit is contained in:
parent
fc79e9353b
commit
e4cdf652a2
2 changed files with 23 additions and 4 deletions
|
|
@ -49,6 +49,9 @@ export default async function build(dev = Dev, log = true) {
|
|||
},
|
||||
pifeForModuleWrappers: true,
|
||||
},
|
||||
experimental: {
|
||||
lazyBarrel: true,
|
||||
},
|
||||
preserveEntrySignatures: false,
|
||||
transform: {
|
||||
define: {
|
||||
|
|
@ -123,13 +126,32 @@ export default async function build(dev = Dev, log = true) {
|
|||
})
|
||||
|
||||
await bundle.write({
|
||||
minify: 'dce-only',
|
||||
minify: dev
|
||||
? 'dce-only'
|
||||
: {
|
||||
codegen: {
|
||||
removeWhitespace: false,
|
||||
},
|
||||
mangle: {
|
||||
keepNames: true,
|
||||
},
|
||||
compress: {
|
||||
joinVars: true,
|
||||
keepNames: {
|
||||
class: true,
|
||||
function: true,
|
||||
},
|
||||
unused: true,
|
||||
},
|
||||
},
|
||||
esModule: false,
|
||||
minifyInternalExports: true,
|
||||
hoistTransitiveImports: false,
|
||||
file: 'dist/revenge.js',
|
||||
format: 'iife',
|
||||
keepNames: true,
|
||||
postFooter: `//# sourceURL=Revenge`,
|
||||
topLevelVar: true,
|
||||
})
|
||||
|
||||
if (log)
|
||||
|
|
|
|||
|
|
@ -37,9 +37,6 @@ export default function hermesCPlugin({
|
|||
const file = bundle['revenge.js'] as OutputChunk
|
||||
if (!file) throw new Error('No code to compile')
|
||||
|
||||
// TODO(scripts/build): Remove this when we have a better way to add sourceURL
|
||||
file.code += `//# sourceURL=Revenge`
|
||||
|
||||
const cmdlist = [binPath, '-emit-binary', ...(flags ?? [])]
|
||||
|
||||
const cmd = Bun.spawnSync<'pipe', 'pipe'>(cmdlist, {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue