Skip to content

Commit

Permalink
use rolldown to minify, always produce sourcemap
Browse files Browse the repository at this point in the history
  • Loading branch information
ceifa committed Jan 18, 2025
1 parent 651eab9 commit 16a4df3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ "$1" == "dev" ];
then
extension="-O0 -g3 -s ASSERTIONS=1 -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=2"
else
extension="-O3 --closure 1"
extension="-O3"
fi

emcc \
Expand All @@ -31,7 +31,6 @@ emcc \
'preRun'
]" \
-s ENVIRONMENT="web,worker,node" \
-s STRICT_JS=0 \
-s MODULARIZE=1 \
-s ALLOW_TABLE_GROWTH=1 \
-s EXPORT_NAME="initWasmModule" \
Expand Down
9 changes: 6 additions & 3 deletions rolldown.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { defineConfig } from 'rolldown'
import copy from 'rollup-plugin-copy'
import pkg from './package.json' with { type: 'json' }

const production = !process.env.ROLLUP_WATCH

export default {
export default defineConfig({
input: './src/index.ts',
output: {
file: 'dist/index.js',
format: 'esm',
sourcemap: !production,
sourcemap: true,
minify: production,
},
external: ['module'],
define: {
// Webpack workaround: https://github.com/webpack/webpack/issues/16878
'import.meta': 'Object(import.meta)',
Expand All @@ -32,4 +35,4 @@ export default {
targets: [{ src: 'build/glue.wasm', dest: 'dist' }],
}),
],
}
})

0 comments on commit 16a4df3

Please sign in to comment.