-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathrollup.config.js
42 lines (40 loc) · 1.23 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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import sucrase from '@rollup/plugin-sucrase';
import json from '@rollup/plugin-json';
import pkg from './package.json';
export default [
{
input: 'src/index.ts',
plugins: [
resolve(), // so Rollup can find external packages
commonjs({ ignoreGlobal: true }), // so Rollup can convert external packages to ES modules
sucrase({
// so Rollup can convert TypeScript to JavaScript
exclude: ['node_modules/**', '**/?(*.)test.ts'],
transforms: ['typescript'],
}),
json(),
],
output: [
{ file: pkg.main, format: 'cjs' },
{ file: pkg.module, format: 'es' },
],
},
{
input: 'src/options.ts',
plugins: [
resolve(), // so Rollup can find external packages
commonjs({ ignoreGlobal: true }), // so Rollup can convert external packages to ES modules
sucrase({
// so Rollup can convert TypeScript to JavaScript
exclude: ['node_modules/**', '**/?(*.)test.ts'],
transforms: ['typescript'],
}),
],
output: [
{ file: 'dist/options.js', format: 'cjs' },
{ file: 'dist/options.esm.js', format: 'es' },
],
},
];