From a4fa070ad5c1a418cdb7ef542fbbc9607dccefad Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 6 Sep 2022 09:21:17 +0100 Subject: [PATCH] refactor(vite): reuse resolved server entry from context (#7268) --- packages/vite/src/server.ts | 4 ++-- packages/vite/src/vite-node.ts | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/vite/src/server.ts b/packages/vite/src/server.ts index 0caba90c4c..a6eedeb21a 100644 --- a/packages/vite/src/server.ts +++ b/packages/vite/src/server.ts @@ -3,7 +3,7 @@ import { resolve } from 'pathe' import * as vite from 'vite' import vuePlugin from '@vitejs/plugin-vue' import viteJsxPlugin from '@vitejs/plugin-vue-jsx' -import { logger, resolveModule } from '@nuxt/kit' +import { logger, resolveModule, resolvePath } from '@nuxt/kit' import { joinURL, withoutLeadingSlash, withTrailingSlash } from 'ufo' import { ViteBuildContext, ViteOptions } from './vite' import { wpfs } from './utils/wpfs' @@ -14,7 +14,7 @@ import { ssrStylesPlugin } from './plugins/ssr-styles' export async function buildServer (ctx: ViteBuildContext) { const useAsyncEntry = ctx.nuxt.options.experimental.asyncEntry || (ctx.nuxt.options.vite.devBundler === 'vite-node' && ctx.nuxt.options.dev) - ctx.entry = resolve(ctx.nuxt.options.appDir, useAsyncEntry ? 'entry.async' : 'entry') + ctx.entry = await resolvePath(resolve(ctx.nuxt.options.appDir, useAsyncEntry ? 'entry.async' : 'entry')) const _resolve = (id: string) => resolveModule(id, { paths: ctx.nuxt.options.modulesDir }) const serverConfig: vite.InlineConfig = vite.mergeConfig(ctx.config, { diff --git a/packages/vite/src/vite-node.ts b/packages/vite/src/vite-node.ts index e28f05c131..4dc849abcc 100644 --- a/packages/vite/src/vite-node.ts +++ b/packages/vite/src/vite-node.ts @@ -123,11 +123,6 @@ function createViteNodeMiddleware (ctx: ViteBuildContext, invalidates: Set