From 4430c664e89020112f41681c67b74c61c4f7e218 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Mar 2023 21:35:51 +0000 Subject: [PATCH] fix(vite): support multiple rollup entries (#19842) --- packages/vite/src/client.ts | 4 ++-- packages/vite/src/server.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/client.ts b/packages/vite/src/client.ts index 43e87a36f9..971713ddd8 100644 --- a/packages/vite/src/client.ts +++ b/packages/vite/src/client.ts @@ -57,7 +57,7 @@ export async function buildClient (ctx: ViteBuildContext) { manifest: true, outDir: resolve(ctx.nuxt.options.buildDir, 'dist/client'), rollupOptions: { - input: ctx.entry + input: { entry: ctx.entry } } }, plugins: [ @@ -110,7 +110,7 @@ export async function buildClient (ctx: ViteBuildContext) { port: hmrPortDefault, ports: Array.from({ length: 20 }, (_, i) => hmrPortDefault + 1 + i) }) - clientConfig.server = defu(clientConfig.server, { + clientConfig.server = defu(clientConfig.server, { https: ctx.nuxt.options.devServer.https, hmr: { protocol: ctx.nuxt.options.devServer.https ? 'wss' : 'ws', diff --git a/packages/vite/src/server.ts b/packages/vite/src/server.ts index 613791f098..e6f96e1ac7 100644 --- a/packages/vite/src/server.ts +++ b/packages/vite/src/server.ts @@ -87,10 +87,10 @@ export async function buildServer (ctx: ViteBuildContext) { outDir: resolve(ctx.nuxt.options.buildDir, 'dist/server'), ssr: true, rollupOptions: { - input: entry, + input: { server: entry }, external: ['#internal/nitro', ...ctx.nuxt.options.experimental.externalVue ? ['vue', 'vue-router'] : []], output: { - entryFileNames: 'server.mjs', + entryFileNames: '[name].mjs', format: 'module', generatedCode: { constBindings: true