This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
66 lines (63 loc) · 1.69 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
58
59
60
61
62
63
64
65
66
import resolve from 'rollup-plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import copy from 'rollup-plugin-copy'
import babel from '@rollup/plugin-babel'
import svg from 'rollup-plugin-svg'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import pkg from './package.json'
module.exports = (commandLineArgs) => {
delete pkg.devDependencies
delete pkg.scripts
const config = {
external: ['stream', 'react', 'react-dom'],
inlineDynamicImports: true,
plugins: [
peerDepsExternal(),
babel({
presets: [['@babel/preset-react', { runtime: 'automatic' }]],
babelHelpers: 'bundled',
exclude: 'node_modules/**',
}),
resolve({
browser: true,
jsnext: true,
extensions: ['.js', '.jsx'],
}),
commonjs(),
svg({ base64: true }),
...(!commandLineArgs.watch
? [
copy({
targets: [{ src: 'src/typings/*', dest: './' }],
}),
]
: []),
],
}
return [
{
input: './src/index.jsx',
output: [
{ file: `cjs/index.js`, format: 'cjs', sourcemap: true },
{ file: `esm/index.js`, format: 'es', sourcemap: true },
],
...config,
},
{
input: './src/icons/index.jsx',
output: [
{ file: `cjs/icons.js`, format: 'cjs', sourcemap: true },
{ file: `esm/icons.js`, format: 'es', sourcemap: true },
],
...config,
},
{
input: './src/common/colors.js',
output: [
{ file: `cjs/colors.js`, format: 'cjs', sourcemap: true },
{ file: `esm/colors.js`, format: 'es', sourcemap: true },
],
...config,
},
]
}