generated from esm-bundle/autopublish-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
36 lines (34 loc) · 945 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
34
35
36
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import replace from "@rollup/plugin-replace";
import { terser } from "rollup-plugin-terser";
function createConfig(format, env) {
const dir = format === "module" ? "esm" : format;
const isProd = env === "production";
const suffix = isProd ? ".production.min" : ".development";
return {
input: `src/index.js`,
output: {
file: `${dir}/react-is${suffix}.js`,
sourcemap: true,
format,
exports: "named",
},
plugins: [
resolve(),
commonjs(),
replace({
values: {
"process.env.NODE_ENV": JSON.stringify(env),
},
}),
isProd && terser(),
].filter(Boolean),
};
}
export default [
createConfig("module", "development"),
createConfig("module", "production"),
createConfig("system", "development"),
createConfig("system", "production"),
];