From df6839559d4c33ec72602d31e2d910c8639c82f6 Mon Sep 17 00:00:00 2001 From: gtmnayan Date: Sat, 15 Apr 2023 20:57:34 +0545 Subject: [PATCH] skip writeBundle for cjs build --- rollup.config.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 8f42e19671..06cf07bf8f 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -42,10 +42,10 @@ export default [ index: "src/runtime/index.ts", ssr: "src/runtime/ssr.ts", }, - output: ["esm", "cjs"].map( + output: ["es", "cjs"].map( /** @returns {import('rollup').OutputOptions} */ (format) => { - const ext = format === "esm" ? "mjs" : "js"; + const ext = format === "es" ? "mjs" : "js"; return { entryFileNames: (entry) => { if (entry.isEntry) { @@ -75,8 +75,10 @@ export default [ }), ts_plugin, { - writeBundle(_options, bundle) { - for (const [_, entry] of Object.entries(bundle)) { + writeBundle(options, bundle) { + if (options.format !== "es") return; + + for (const entry of Object.values(bundle)) { const dir = entry.name; if (!entry.isEntry || !runtime_entrypoints[dir]) continue;