-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
55 lines (50 loc) · 1.03 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
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'
import pkg from './package.json'
const extensions = ['.js', '.jsx', '.ts', '.tsx']
const plugins = [
babel({
exclude: 'node_modules/**',
extensions,
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
}),
localResolve(),
nodeResolve({
browser: true,
extensions,
}),
commonjs(),
]
const external = ['react', 'react-dom']
const globals = {
react: 'React',
'react-dom': 'ReactDOM',
}
export default {
input: 'packages/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
exports: 'named',
globals,
},
{
file: pkg.module,
format: 'es',
exports: 'named',
globals,
},
{
file: pkg.browser,
format: 'umd',
exports: 'named',
name: 'Contextable',
globals,
},
],
external,
plugins,
}