Skip to content

Commit 6d4540c

Browse files
authored
Merge pull request #7973 from nickswalker/minify-esm-build
Add minified ESM build output
2 parents e2fc4b3 + 6c56f2f commit 6d4540c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"lib/p5.min.js",
9191
"lib/p5.js",
9292
"lib/p5.esm.js",
93+
"lib/p5.esm.min.js",
9394
"translations/**",
9495
"types/**"
9596
],

rollup.config.mjs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ rmSync("./dist", {
8989
});
9090

9191
export default [
92-
//// Unminified and ESM library build ////
92+
//// Library builds (IIFE and ESM) ////
9393
{
9494
input: 'src/app.js',
9595
output: [
@@ -109,6 +109,25 @@ export default [
109109
plugins: [
110110
bundleSize('p5.esm.js')
111111
]
112+
},
113+
{
114+
file: './lib/p5.esm.min.js',
115+
format: 'esm',
116+
banner,
117+
sourcemap: 'hidden',
118+
plugins: [
119+
terser({
120+
compress: {
121+
global_defs: {
122+
IS_MINIFIED: true
123+
}
124+
},
125+
format: {
126+
comments: false
127+
}
128+
}),
129+
bundleSize('p5.esm.min.js', true)
130+
]
112131
}
113132
],
114133
treeshake: {

0 commit comments

Comments
 (0)