forked from reown-com/appkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
44 lines (41 loc) · 1.05 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
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import resolve from '@rollup/plugin-node-resolve'
import esbuild from 'rollup-plugin-esbuild'
import minifyHtml from 'rollup-plugin-minify-html-literals'
export default function createConfig(packageName) {
const sharedOutput = {
exports: 'named',
name: packageName,
sourcemap: true
}
const esbuildPlugin = esbuild({
minify: true,
tsconfig: './tsconfig.json',
platform: 'browser',
treeShaking: true,
loaders: {
'.json': 'json'
}
})
return [
{
input: './index.ts',
plugins: [minifyHtml(), esbuildPlugin],
output: [{ file: './dist/index.js', format: 'es', ...sharedOutput }]
},
{
input: './index.ts',
plugins: [
minifyHtml(),
resolve({ browser: true, preferBuiltins: true }),
json(),
commonjs(),
esbuildPlugin
],
output: [
{ file: './dist/index.umd.js', format: 'umd', inlineDynamicImports: true, ...sharedOutput }
]
}
]
}