-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.prod.js
61 lines (60 loc) · 1.51 KB
/
rollup.config.prod.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
import closureCompiler from "@ampproject/rollup-plugin-closure-compiler";
import commonjs from "rollup-plugin-commonjs";
import image from 'rollup-plugin-inline-image';
import pkg from "./package.json";
import postcss from "rollup-plugin-postcss";
import resolve from "rollup-plugin-node-resolve";
import tsplugin from "rollup-plugin-typescript2";
export default [
{
input: "src/emg.tsx",
output: {
name: pkg.name,
file: pkg.browser,
format: "umd",
sourcemap: true,
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
external: ["react", "react-dom"],
plugins: [
image(),
postcss({
modules: false,
}),
tsplugin({
// NOTE: enable this to work compatable with closure compiler,
// or will cause Unknown object type "asyncfunction" error
clean: true,
tsconfigOverride: {
compilerOptions: {
declaration: false,
},
},
}),
resolve(),
commonjs(),
closureCompiler(),
],
},
{
input: "src/emg.tsx",
output: [{ file: pkg.main, format: "cjs" }, { file: pkg.module, format: "es" }],
external: ["react", "react-dom"],
plugins: [
image(),
postcss({
modules: false,
}),
tsplugin({
clean: true,
tsconfigOverride: {
// NOTE: exclude to avoid unwanted files generated for publishing
exclude: ["examples", "__mocks__", "__tests__"],
},
}),
],
},
];