-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
33 lines (31 loc) · 934 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
31
32
33
import babel from "rollup-plugin-babel";
import resolve from "rollup-plugin-node-resolve";
import replace from "rollup-plugin-replace";
import { terser } from "rollup-plugin-terser";
import postprocess from 'rollup-plugin-postprocess';
const NODE_ENV = process.env.NODE_ENV || "development ";
const outputFile = NODE_ENV === "production" ? "./dist/index.js" : "./dist/index_dev.js";
const minimizeCss = NODE_ENV === "production";
const minimizeJs = NODE_ENV === "production";
export default {
input: "./src/lib/index.js",
output: {
file: outputFile,
format: "esm"
},
plugins: [
postprocess([
[/^import/,'import "./index.css";import']
]),
replace({
"process.env.NODE_ENV": JSON.stringify(NODE_ENV)
}),
babel({
exclude: "node_modules/**",
configFile: "./.babelrc"
}),
resolve(),
minimizeJs ? terser() : null
],
external: id => /^react|styled-jsx/.test(id)
};