-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
57 lines (52 loc) · 1.44 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
52
53
54
55
56
57
import 'rollup';
import typescript from '@rollup/plugin-typescript';
import buble from '@rollup/plugin-buble';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import dts from 'rollup-plugin-dts'
import { uglify } from 'rollup-plugin-uglify';
import { minify } from 'uglify-js';
/**
* Default/development Build
*/
const config = [
{
input: 'src/index.ts',
output: {
file: 'dist/index.js',
format: 'es',
},
plugins: [
typescript({
typescript: require('typescript')
}),
buble({
transforms: {
forOf: false,
generator: false,
}
}),
nodeResolve({
jsnext: true,
main: true
}),
commonjs()
],
},
{
// path to your declaration files root
input: './dist/dts/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'es' }],
plugins: [dts()],
},
];
// Minified JS Build
if (process.env.BUILD === 'minify') {
config[0].plugins.push(
uglify({}, minify)
);
}
// Report destination paths on console
console.info(`\u001b[36m\[Rollup ${process.env.BUILD} build\]\u001b[97m \nConverting Typescript from ${
config[0].input} to javascript, exporting to: ${config[0].output.file}`);
export default config