-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrollup.config.js
66 lines (64 loc) · 1.71 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import nodePolyFills from 'rollup-plugin-polyfill-node';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import clientPkg from './packages/client/package.json';
const browserClient = {
input: 'packages/client/index.ts',
external: ['lit-js-sdk'], // if users want encryption they can install this module
output: {
file: `packages/client/dist/rip-client.es-browser.js`,
format: 'esm',
intro: 'console.log("IMPORTING RIP CLIENT BROWSER ESM");',
sourcemap: true,
inlineDynamicImports: true,
},
plugins: [
nodeResolve({
browser: true,
}),
commonjs({
esmExternals: true,
}),
typescript(),
nodePolyFills(),
],
};
export default [
// THE BROWSER CLIENT
browserClient,
// THE BROWSER CLIENT (FOR CDN)
{
...browserClient,
output: {
...browserClient.output,
file: `dist/rip-client.es-browser${clientPkg.version}.js`,
},
},
// THE NODE CLIENT
{
input: './packages/client/index.ts',
external: (id) => !/^[./]/.test(id),
output: {
file: `packages/client/dist/rip-client.es-node.js`,
format: 'esm',
intro: 'console.log("IMPORTING RIP CLIENT NODE ESM")',
sourcemap: true,
inlineDynamicImports: true,
},
plugins: [typescript()],
},
// THE NODE SERVER CLIENT
{
input: './packages/server/index.ts',
external: (id) => !/^[./]/.test(id),
output: {
file: `packages/server/dist/rip-server.es-node.js`,
format: 'esm',
intro: 'console.log("IMPORTING RIP SERVER NODE ESM")',
sourcemap: true,
inlineDynamicImports: true,
},
plugins: [typescript()],
},
];