-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
53 lines (51 loc) · 1.47 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
import babel from '@rollup/plugin-babel'
import del from 'rollup-plugin-delete'
import pkg from './package.json'
import { terser } from 'rollup-plugin-terser'
import copy from 'rollup-plugin-copy'
import command from 'rollup-plugin-command';
import scss from 'rollup-plugin-scss'
import typescript from '@rollup/plugin-typescript';
import dts from "rollup-plugin-dts";
//import { visualizer } from "rollup-plugin-visualizer";
const isDev = process.env.NODE_ENV !== 'production'
const isYalcActivated = process.env.YALC === 'activated'
export default [{
input: pkg.source,
output: [
{ file: pkg.main, format: 'esm' }
],
plugins: [
// visualizer(),
del({ targets: ['dist/*', 'lib/*', 'examples/node_modules/@maif/react-forms/lib'], verbose: true }),
typescript(),
scss(),
babel({
exclude: [
'docs/**',
'node_modules/**'
],
babelHelpers: 'bundled'
}),
isDev ? undefined : terser(),
copy({
targets: [
{
src: 'lib',
dest: 'examples/node_modules/@maif/react-forms'
}
],
verbose: true,
hook: 'closeBundle'
}),
isYalcActivated ? command('yalc push --replace') : undefined
].filter(f => f),
external: Object.keys(pkg.peerDependencies || {})
},
{
input: "./types/index.d.ts",
output: [{ file: "lib/index.d.ts", format: "es" }],
plugins: [dts()],
external: [/\.css$/u, /\.scss$/u]
},
];