-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathrolldown.config.ts
38 lines (36 loc) · 1.02 KB
/
rolldown.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 defineConfig({
input: './src/index.ts',
output: {
file: 'dist/index.js',
format: 'esm',
sourcemap: true,
minify: production,
},
external: ['module'],
define: {
// Webpack workaround: https://github.com/webpack/webpack/issues/16878
'import.meta': 'Object(import.meta)',
},
plugins: [
{
name: 'package-version',
resolveId(source) {
if (source === 'package-version') {
return 'package-version'
}
},
load(id) {
if (id === 'package-version') {
return `export default '${pkg.version}'`
}
},
},
copy({
targets: [{ src: 'build/glue.wasm', dest: 'dist' }],
}),
],
})