diff --git a/package.json b/package.json index 644470ad6b..422f6c588d 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,7 @@ "lib/p5.min.js", "lib/p5.js", "lib/p5.esm.js", + "lib/p5.esm.min.js", "translations/**", "types/**" ], diff --git a/rollup.config.mjs b/rollup.config.mjs index 78abc3a23a..0c48afb163 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -89,7 +89,7 @@ rmSync("./dist", { }); export default [ - //// Unminified and ESM library build //// + //// Library builds (IIFE and ESM) //// { input: 'src/app.js', output: [ @@ -109,6 +109,25 @@ export default [ plugins: [ bundleSize('p5.esm.js') ] + }, + { + file: './lib/p5.esm.min.js', + format: 'esm', + banner, + sourcemap: 'hidden', + plugins: [ + terser({ + compress: { + global_defs: { + IS_MINIFIED: true + } + }, + format: { + comments: false + } + }), + bundleSize('p5.esm.min.js', true) + ] } ], treeshake: {