-
Notifications
You must be signed in to change notification settings - Fork 161
/
rollup.config.dev.js
94 lines (90 loc) · 2.35 KB
/
rollup.config.dev.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import babel from "rollup-plugin-babel";
import commonjs from "rollup-plugin-commonjs";
import { eslint } from "rollup-plugin-eslint";
import livereload from "rollup-plugin-livereload";
import image from "rollup-plugin-img";
import omit from "object.omit";
import path from "path";
import postcss from "rollup-plugin-postcss";
import replace from "rollup-plugin-replace";
import resolve from "rollup-plugin-node-resolve";
import serve from "rollup-plugin-serve";
var pkg = require("./package.json");
var cache;
const plugins = [
image({
limit: 10000
}),
postcss({
extensions: [".css", ".scss"],
extract: "dev/script/style.css",
minimize: true,
modules: {
// customize the name of the css classes that are created
generateScopedName: "[local]___[hash:base64:5]"
},
sourceMap: "inline" // true, "inline" or false
}),
resolve({
browser: true,
customResolveOptions: {
moduleDirectory: "node_modules"
},
extensions: [".js", ".jsx"],
jsnext: true,
main: true,
module: true
}),
replace({ "process.env.NODE_ENV": JSON.stringify("development") }),
commonjs({
include: ["node_modules/**"],
exclude: ["node_modules/process-es6/**"],
namedExports: {
"node_modules/react/index.js": [
"Children",
"Component",
"Fragment",
"PureComponent",
"createElement",
"lazy",
"useState",
"Suspense"
],
"node_modules/react-dom/index.js": ["render"],
"node_modules/react-is/index.js": ["isValidElementType"]
}
}),
eslint({
exclude: ["**/*.scss", "**/*.css", "node_modules/**"]
}),
babel({
exclude: ["node_modules/**", "__tests__/**"]
}),
];
if (process.env.npm_lifecycle_event === 'start') {
plugins.push(
serve({
open: true,
verbose: true,
contentBase: ["dev"],
historyApiFallback: false,
host: "localhost",
port: 10001
}),
livereload()
)
}
export default {
input: "src/app.js",
cache: cache,
output: {
file: "dev/script/index.umd.js",
format: "umd",
name: "pureReactCarousel",
sourcemap: true,
sourcemapFile: path.resolve("dev/main.umd.js")
},
// exclude peerDependencies from our bundle, except for react, react-dom, prop-types when dev'ing
external: Object.keys(omit(pkg.peerDependencies, ["react", "react-dom"])),
plugins
};