-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
55 lines (52 loc) · 1.33 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
const babel = require('@rollup/plugin-babel');
const commonjs = require('@rollup/plugin-commonjs');
const typescript = require('@rollup/plugin-typescript');
const postcss = require('rollup-plugin-postcss');
const terser = require('@rollup/plugin-terser');
const replace = require('@rollup/plugin-replace');
const pkg = require('./package.json');
const isProduction = !process.env.IS_DEVELOPMENT;
const sourcemap = !isProduction;
module.exports = {
input: 'src/index.tsx',
watch: {
include: 'src/**/*',
exclude: 'node_modules/**/*',
chokidar: {
// usePolling: true
}
},
external: ['react', 'react-dom'],
plugins: [
replace({
'__dev__': !isProduction,
preventAssignment: true
}),
babel({
babelHelpers: "runtime",
exclude: "**/node_modules/**",
extensions: [".js", ".jsx", ".ts", ".tsx"],
}),
typescript({ sourceMap: sourcemap, tsconfig: './tsconfig.json' }),
commonjs(),
postcss({
extract: true,
modules: false,
use: ['sass']
}),
isProduction && terser({ sourceMap: sourcemap })
],
output: [
{
name: "react-horizontal-vertical",
file: pkg.main,
format: 'umd',
globals: {
react: 'React',
'react-dom': 'ReactDOM',
},
sourcemap
},
{ file: pkg.module, format: 'es', sourcemap }
]
};