-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrollup.config.js
More file actions
39 lines (37 loc) · 874 Bytes
/
rollup.config.js
File metadata and controls
39 lines (37 loc) · 874 Bytes
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
import typescript from '@rollup/plugin-typescript';
import json from '@rollup/plugin-json';
import { terser } from 'rollup-plugin-terser';
import { join } from 'path';
const cwd = process.cwd();
const packagePath = join(cwd, 'package.json');
const pkg = require(packagePath);
export default async () => ({
input: 'src/index.ts',
output: [
{ format: 'es', file: pkg.module, sourcemap: true },
{
format: 'umd',
file: pkg.main,
name: pkg.name,
sourcemap: true,
esModule: false
}
],
external: [
/node_modules/
],
plugins: [
json({ compact: true }),
typescript({
tsconfig: 'tsconfig.build.json'
}),
terser({
ecma: 2020,
module: true,
warnings: true
}),
...(process.env.ANALYZE === '1'
? [(await import('rollup-plugin-visualizer')).visualizer()]
: [])
]
});