-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.js
58 lines (52 loc) · 1.34 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
56
57
58
import styles from "rollup-plugin-styles";
import { terser } from "rollup-plugin-terser";
import sourcemaps from "rollup-plugin-sourcemaps";
import babel from "@rollup/plugin-babel";
const autoPrefixer = require("autoprefixer");
const entry_point = "src/index.js";
var MODE = [
{
format: "cjs",
},
{
format: "esm",
},
{
format: "umd",
},
];
var config = [];
MODE.map((m) => {
var conf = {
input: entry_point,
output: {
name: "react-mdr",
file: `dist/index.${m.format}.js`,
format: m.format,
exports: "auto",
globals: {
react: "React",
"react-dom": "ReactDOM",
"prop-types": "PropTypes",
},
},
// prevent rollup from compiling React files
external: ["react", "react-dom", "prop-types", /@babel\/runtime/],
plugins: [
babel({
exclude: "node_modules/**",
plugins: ["@babel/transform-runtime"],
babelHelpers: "runtime",
}),
sourcemaps(),
terser(),
styles({
postcss: {
plugins: [autoPrefixer()],
},
}),
],
};
config.push(conf);
});
export default [...config];