From 52499221874e23ec437c416f4fc5ef3edb771857 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 3 Jun 2022 21:21:32 +0800 Subject: [PATCH] chore: update --- src/node/plugin.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/node/plugin.ts b/src/node/plugin.ts index af91a343..05dc9808 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -215,6 +215,17 @@ export async function createVitePressPlugin( delete bundle[name] } } + + // in Vite v3 + // we generate a fake package.json to make the output `.js` as ESM + // @ts-ignore + if (config.ssr?.format === 'esm') { + this.emitFile({ + type: 'asset', + fileName: 'package.json', + source: '{ "private": true, "type": "module" }' + }) + } } else { // client build: // for each .md entry chunk, adjust its name to its correct path.