-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
50 lines (45 loc) · 1.06 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
import commonjs from '@rollup/plugin-commonjs'
import nodeResolve from '@rollup/plugin-node-resolve'
import localResolve from 'rollup-plugin-local-resolve'
import babel from 'rollup-plugin-babel'
const extensions = ['.js', '.jsx', '.ts', '.tsx']
const plugins = [
babel({
exclude: 'node_modules/**',
extensions,
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
plugins: ['styled-jsx/babel'],
babelrc: false,
}),
localResolve(),
nodeResolve({
browser: true,
extensions,
}),
commonjs(),
]
const external = id => /^react|react-dom|@geist-ui\/core/.test(id)
const globals = {
react: 'React',
'react-dom': 'ReactDOM',
}
export default {
input: 'packages/index.ts',
output: [
{
entryFileNames: 'index.js',
format: 'cjs',
exports: 'named',
dir: 'dist',
globals,
manualChunks: id => {
if (id.includes('node_modules/styled-jsx')) {
return 'styled-jsx.cjs'
}
},
chunkFileNames: '[name].js',
},
],
external,
plugins,
}