-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrollup.config.js
51 lines (50 loc) · 1.3 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
import typescript from 'rollup-plugin-typescript2';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import nodePolyfills from 'rollup-plugin-node-polyfills';
import commonjs from '@rollup/plugin-commonjs';
import del from 'rollup-plugin-delete';
import json from '@rollup/plugin-json';
import copy from 'rollup-plugin-copy';
import packageJson from './package.json';
export default {
input: 'index.ts',
output: [
{
file: packageJson.publishConfig.browser,
name: packageJson.name,
format: 'umd'
},
{
file: packageJson.publishConfig.module,
name: packageJson.name,
format: 'es',
sourcemap: true
},
{
file: packageJson.publishConfig.main,
name: packageJson.name,
format: 'cjs',
sourcemap: true
}
],
plugins: [
del({ targets: 'dist/*', runOnce: true }),
nodeResolve({
preferBuiltins: false,
extensions: ['.ts']
}), //
nodePolyfills(),
typescript({ abortOnError: true, sourcemap: true, useTsconfigDeclarationDir: true }),
commonjs(),
json(),
copy({
targets: [
{
src: './package.json',
dest: './dist'
}
]
})
],
external: [...Object.keys(packageJson.dependencies || {}), ...Object.keys(packageJson.peerDependencies || {})]
};