-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
40 lines (38 loc) · 1.12 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
import clear from 'rollup-plugin-clear'
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import json from '@rollup/plugin-json';
import { preserveShebangs } from 'rollup-plugin-preserve-shebangs';
import { terser } from 'rollup-plugin-terser';
const extensions = ['.js', '.ts'];
const babelConfig = {
presets: ['@babel/env', '@babel/typescript'],
plugins: ['@babel/transform-runtime', '@babel/proposal-class-properties'],
};
export default {
input: 'sources/index.ts',
output: {
file: 'dist/index.js',
format: 'cjs'
},
external: ['commander', 'path', 'fs', 'chalk', 'ora', 'mkdirp'],
plugins: [
clear({ targets: ['dist'], }),
preserveShebangs(),
json(),
// Allows node_modules resolution
resolve({ extensions }),
// Allow bundling cjs modules. Rollup doesn't understand cjs
commonjs(),
// Compile TypeScript/JavaScript files
babel({
...babelConfig,
runtimeHelpers: true,
extensions,
exclude: 'node_modules/**',
}),
// Minify generated es bundle
terser(),
]
};