-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathrollup.config.node.js
44 lines (41 loc) · 1.2 KB
/
rollup.config.node.js
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
39
40
41
42
43
44
import terser from '@rollup/plugin-terser';
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
const cp = copy({
targets: [
{ src: 'src/build/js/index.wasm', dest: 'dist' },
{ src: 'src/build/bc/share/proj', dest: 'dist' },
{ src: 'src/index.mjs', dest: 'dist' },
]
});
export default args => ({
input: 'src/spl-node.mjs',
output: [
{ file: 'dist/spl-node.mjs', format: 'es', exports: 'auto'}
],
plugins: args.configDebug ? [
replace({
preventAssignment: true,
delimiters: ["'", "'"],
values: { './build/js/em-worker.js': JSON.stringify('./build/js/index.js') }
}),
nodeResolve(),
json(),
commonjs(),
cp
] : [
replace({
preventAssignment: true,
delimiters: ["'", "'"],
values: { './build/js/em-worker.js': JSON.stringify('./build/js/index.js') }
}),
nodeResolve(),
json(),
commonjs(),
terser(),
cp
]
});