forked from ceifa/wasmoon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
37 lines (35 loc) · 979 Bytes
/
rollup.config.mjs
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
import typescript from '@rollup/plugin-typescript'
import copy from 'rollup-plugin-copy'
import pkg from './package.json' assert { type: 'json' }
const production = !process.env.ROLLUP_WATCH
export default {
input: './src/index.ts',
output: {
file: 'dist/index.js',
format: 'umd',
name: 'wasmoon',
sourcemap: !production,
},
plugins: [
{
name: 'package-version',
resolveId(source) {
if (source === 'package-version') {
return 'package-version'
}
},
load(id) {
if (id === 'package-version') {
return `export default '${pkg.version}'`
}
},
},
typescript({
sourceMap: !production,
outputToFilesystem: true,
}),
copy({
targets: [{ src: 'build/glue.wasm', dest: 'dist' }],
}),
],
}