forked from rocicorp/replicache
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
45 lines (40 loc) · 1.06 KB
/
Copy pathrollup.config.js
File metadata and controls
45 lines (40 loc) · 1.06 KB
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 typescript from '@wessberg/rollup-plugin-ts';
import replace from '@rollup/plugin-replace';
import copy from 'rollup-plugin-copy';
/* eslint-env node */
const dir = 'out';
const cjs = process.env.CJS !== undefined;
const format = cjs ? 'cjs' : 'es';
const ext = cjs ? 'js' : 'mjs';
export default {
input: 'src/mod.ts',
output: {
file: `./${dir}/replicache.${ext}`,
format,
},
plugins: [
// Use replicache.wasm in same directory as replicache.js
replace({
['./wasm/release/replicache_client_bg.wasm']: `'./replicache.wasm'`,
delimiters: [`'`, `'`],
include: 'src/repm-invoker.ts',
preventAssignment: true,
}),
typescript(),
// Copy wasm files to out directory
copy({
targets: [
{
src: `src/wasm/release/replicache_client_bg.wasm`,
dest: `./${dir}/`,
rename: `replicache.wasm`,
},
{
src: `src/wasm/debug/replicache_client_bg.wasm`,
dest: `./${dir}/`,
rename: `replicache.dev.wasm`,
},
],
}),
],
};