-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
30 lines (27 loc) · 868 Bytes
/
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
import resolve from '@rollup/plugin-node-resolve'
import babel from 'rollup-plugin-babel'
import { terser } from "rollup-plugin-terser"
import commonjs from 'rollup-plugin-commonjs'
const env = process.env.NODE_ENV
const config = {
input: 'src/index.js',
output: [
{ file: 'dist/index.esm.js', format: 'es' },
{ file: 'dist/index.umd.js', format: 'umd', name: 'env', globals: { react: 'React', 'react-dom': 'ReactDOM', 'prop-types': 'PropTypes', 'better-scroll': 'BScroll' } }
],
plugins: [
resolve(),
babel({
exclude: 'node_modules/**' // only transpile our source code
}),
commonjs(),
terser()
],
external: ['react', 'react-dom', 'prop-types'],
devServer: {
headers: {
'Access-Control-Allow-Origin': '*',
},
},
};
export default config