-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.demo.js
58 lines (55 loc) · 1.46 KB
/
rollup.config.demo.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
const babel = require("@rollup/plugin-babel").default;
const commonjs = require("rollup-plugin-commonjs");
const postcss = require("rollup-plugin-postcss");
const resolve = require("rollup-plugin-node-resolve");
const url = require("rollup-plugin-url");
const alias = require("rollup-plugin-alias");
const serve = require("rollup-plugin-serve");
const replace = require("@rollup/plugin-replace");
const livereload = require("rollup-plugin-livereload");
const libName = require("./libName");
const ReactNamedExports = require('react');
const ReactIsNamedExports = require('react-is');
module.exports = {
input: `demoApp/src/index.js`,
output: [
{
file: "demoApp/dist/bundle.js",
format: "cjs",
sourcemap: true,
exports: "named",
},
],
plugins: [
alias({
entries: {
"react-elastic-carousel": `src/${libName}/index.js`,
}
}),
// external(),
postcss({
modules: false,
}),
url(),
babel({
exclude: "node_modules/**",
plugins: ["@babel/external-helpers"],
}),
resolve(),
commonjs({
include: "node_modules/**",
namedExports: {
"node_modules/react-is/index.js": Object.keys(ReactIsNamedExports),
"node_modules/react/index.js": Object.keys(ReactNamedExports),
},
}),
serve({
open: true,
contentBase: "demoApp/dist",
}),
livereload(),
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
}),
],
};