/
rollup.config.js
36 lines (36 loc) · 945 Bytes
/
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
import typescript from 'rollup-plugin-typescript2';
import { terser } from "rollup-plugin-terser";
import pkg from './package.json';
export default {
external: Object.keys(pkg['dependencies'] || []),
input: './src/mylib.ts',
plugins: [
typescript({
tsconfigDefaults: { compilerOptions: {} },
tsconfig: "tsconfig.json",
tsconfigOverride: { compilerOptions: {} },
useTsconfigDeclarationDir: true
}),
terser()
],
output: [
// ES module (for bundlers) build.
{
format: 'esm',
file: pkg.module
},
// CommonJS (for Node) build.
{
format: 'cjs',
file: pkg.main
},
// browser-friendly UMD build
{
format: 'umd',
file: pkg.browser,
name: pkg.browser
.replace(/^.*\/|\.js$/g, '')
.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace('-', '').replace('_', ''))
}
]
}