-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
68 lines (60 loc) · 1.53 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
59
60
61
62
63
64
65
66
67
68
var babel = require("@rollup/plugin-babel");
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import { uglify } from "rollup-plugin-uglify";
require("dotenv").config({ path: "./.env" });
export default {
input: "./src/main.js",
output: [
{
name: "copper3D_nrrd_plugin",
file: "dist/bundle.js",
format: "umd",
},
{
file: "dist/bundle.esm.mjs",
format: "es",
},
],
sourceMap: "inline",
plugins: [
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
babel({
babelHelpers: "bundled",
presets: [["@babel/preset-env", { modules: false }]],
exclude: "node_modules/**",
}),
process.env.NODE_ENV === "production" && uglify(),
],
};
// 在打包时,若存在引用第三方包, 则必须要使用rollup-plugin-node-resolve和rollup-plugin-commonjs来解决,第三方的引入。
// presets: [["@babel/preset-env",{ modules: false }]]
// rollup-plugin-uglify 用于美化压缩代码
// v2
// var babel = require("@rollup/plugin-babel");
// export default {
// input: "./src/main.js",
// output: [
// {
// name: "copper3D_nrrd_plugin",
// file: "dist/bundle.js",
// format: "umd",
// },
// {
// file: "dist/bundle.esm.mjs",
// format: "es",
// },
// ],
// sourceMap: "inline",
// plugins: [
// babel({
// babelHelpers: "bundled",
// presets: [["@babel/preset-env",{ modules: false }]],
// }),
// ],
// };