This repository has been archived by the owner on Apr 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
106 lines (101 loc) · 1.78 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
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
95
96
97
98
99
100
101
102
103
104
105
106
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
// import { nodeResolve } from "@rollup/plugin-node-resolve";
import { terser } from "rollup-plugin-terser";
import babel from "@rollup/plugin-babel";
import pkg from "./package.json";
const input = ["src/index.js"];
export default [
{
input,
output: {
name: 'p5AC',
file: `dist/${pkg.name}.js`,
format: 'iife',
sourcemap: true,
},
plugins: [resolve(), commonjs()]
},
// miinified
{
input,
output: {
name: 'p5AC',
file: `dist/${pkg.name}.min.js`,
format: 'iife',
sourcemap: true,
},
plugins: [
resolve(),
commonjs(),
terser(),
babel({
babelHelpers: "bundled",
}),
]
},
// cjs (webpack, vite)
{
input,
output: {
file: `dist/cjs/${pkg.name}.js`,
format: 'cjs',
sourcemap: true,
exports: 'default',
},
plugins: [resolve(), commonjs()]
},
// esm
{
input,
output: [
{
file: `dist/esm/${pkg.name}.js`,
format: "esm",
exports: "default",
sourcemap: true,
}
],
plugins: [resolve()],
}
];
// export default [
// {
// // UMD minified
// input,
// output: {
// file: `dist/${pkg.name}.min.js`,
// format: "umd",
// name: "p5AC",
// esModule: false,
// exports: "named",
// sourcemap: true,
// },
// plugins: [
// nodeResolve(),
// babel({
// babelHelpers: "bundled",
// }),
// terser(),
// ],
// },
// {
// // ESM and CJS
// input,
// output: [
// {
// file: `dist/${pkg.name}.esm.js`,
// format: "esm",
// exports: "named",
// sourcemap: true,
// },
// {
// file: `dist/${pkg.name}.cjs.js`,
// format: "cjs",
// exports: "named",
// sourcemap: true,
// },
// ],
// plugins: [nodeResolve()],
// },
// ];