-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathrollup.config.js
45 lines (39 loc) · 1.08 KB
/
rollup.config.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
45
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';
const cp = copy({
targets: [
{ src: 'src/glpk.d.ts', dest: 'dist' },
{ src: 'src/.build/glpk.wasm', dest: 'dist' }
]
});
const plugins = [nodeResolve(), commonjs(), terser(), cp];
export default args => {
if (args.worker) {
delete args.worker;
return {
input: 'src/glpk-worker.js',
output: [
{ file: 'src/.build/worker.js', format: 'es', preferConst: true }
],
plugins
};
}
return [
{
input: 'src/glpk-web.js',
output: [
{ file: 'dist/index.js', format: 'es', preferConst: true }
],
plugins
},
{
input: 'src/glpk-node.js',
output: [
{ file: 'dist/glpk.js', format: 'cjs', preferConst: true, exports: 'auto' }
],
plugins
}
];
};