skip writeBundle for cjs build

pull/8504/head
gtmnayan 3 years ago
parent d1b6643394
commit df6839559d

@ -42,10 +42,10 @@ export default [
index: "src/runtime/index.ts", index: "src/runtime/index.ts",
ssr: "src/runtime/ssr.ts", ssr: "src/runtime/ssr.ts",
}, },
output: ["esm", "cjs"].map( output: ["es", "cjs"].map(
/** @returns {import('rollup').OutputOptions} */ /** @returns {import('rollup').OutputOptions} */
(format) => { (format) => {
const ext = format === "esm" ? "mjs" : "js"; const ext = format === "es" ? "mjs" : "js";
return { return {
entryFileNames: (entry) => { entryFileNames: (entry) => {
if (entry.isEntry) { if (entry.isEntry) {
@ -75,8 +75,10 @@ export default [
}), }),
ts_plugin, ts_plugin,
{ {
writeBundle(_options, bundle) { writeBundle(options, bundle) {
for (const [_, entry] of Object.entries(bundle)) { if (options.format !== "es") return;
for (const entry of Object.values(bundle)) {
const dir = entry.name; const dir = entry.name;
if (!entry.isEntry || !runtime_entrypoints[dir]) continue; if (!entry.isEntry || !runtime_entrypoints[dir]) continue;

Loading…
Cancel
Save