1 | import { nodeResolve } from "@rollup/plugin-node-resolve";
|
2 | import babel from "@rollup/plugin-babel";
|
3 | import copy from "rollup-plugin-copy";
|
4 | import { terser } from "rollup-plugin-terser";
|
5 | import cleanup from "rollup-plugin-cleanup";
|
6 | import pkgMinifyHTML from "rollup-plugin-minify-html-literals";
|
7 | import summary from "rollup-plugin-summary";
|
8 | import { visualizer } from "rollup-plugin-visualizer";
|
9 |
|
10 | const minifyHTML = pkgMinifyHTML.default;
|
11 |
|
12 | const input = { bundle: "src/bundle.js", "components/table": "src/components/table.js" };
|
13 |
|
14 | export default [
|
15 |
|
16 | {
|
17 | input,
|
18 | output: {
|
19 | dir: "dist",
|
20 | chunkFileNames: "internals/_[hash].js",
|
21 | entryFileNames: "[name].js",
|
22 |
|
23 | format: "es",
|
24 | },
|
25 | plugins: [
|
26 | nodeResolve({
|
27 | browser: true,
|
28 | }),
|
29 | babel({
|
30 | babelHelpers: "runtime",
|
31 | presets: [
|
32 | [
|
33 | "@babel/preset-env",
|
34 | {
|
35 | bugfixes: true,
|
36 | },
|
37 | ],
|
38 | ],
|
39 | plugins: [
|
40 | [
|
41 | "@babel/plugin-transform-runtime",
|
42 | {
|
43 | absoluteRuntime: false,
|
44 | corejs: false,
|
45 | helpers: true,
|
46 | regenerator: false,
|
47 | },
|
48 | ],
|
49 | ],
|
50 | }),
|
51 | copy({
|
52 | targets: [{ src: "src/zui-loader.js", dest: "dist" }],
|
53 | }),
|
54 | minifyHTML(),
|
55 | terser({
|
56 | ecma: 2020,
|
57 | module: true,
|
58 | warnings: true,
|
59 | }),
|
60 | summary(),
|
61 | visualizer({
|
62 | filename: "dist/zui-bundle-metrics-visualizer.html",
|
63 | }),
|
64 | cleanup({
|
65 | comments: "none",
|
66 | }),
|
67 | ],
|
68 | },
|
69 |
|
70 | {
|
71 | input,
|
72 | output: {
|
73 | dir: "dev",
|
74 | chunkFileNames: "internals/_[hash].js",
|
75 | entryFileNames: "[name].js",
|
76 |
|
77 | format: "es",
|
78 | },
|
79 | plugins: [
|
80 | nodeResolve({
|
81 | browser: true,
|
82 | exportConditions: ["development"],
|
83 | }),
|
84 | babel({
|
85 | babelHelpers: "runtime",
|
86 | presets: [
|
87 | [
|
88 | "@babel/preset-env",
|
89 | {
|
90 | bugfixes: true,
|
91 | },
|
92 | ],
|
93 | ],
|
94 | plugins: [
|
95 | [
|
96 | "@babel/plugin-transform-runtime",
|
97 | {
|
98 | absoluteRuntime: false,
|
99 | corejs: false,
|
100 | helpers: true,
|
101 | regenerator: false,
|
102 | },
|
103 | ],
|
104 | ],
|
105 | }),
|
106 | ],
|
107 | },
|
108 | ];
|