diff --git a/packages/vite/src/node/server/pluginContainer.ts b/packages/vite/src/node/server/pluginContainer.ts index 38c057bbbf8c29..ce851e8d2b24ec 100644 --- a/packages/vite/src/node/server/pluginContainer.ts +++ b/packages/vite/src/node/server/pluginContainer.ts @@ -76,6 +76,7 @@ import { numberToPos, prettifyUrl, timeFrom, + unwrapId, } from '../utils' import { FS_PREFIX } from '../constants' import type { ResolvedConfig } from '../config' @@ -313,7 +314,7 @@ export async function createPluginContainer( } & Partial>, ): Promise { // We may not have added this to our module graph yet, so ensure it exists - await moduleGraph?.ensureEntryFromUrl(options.id) + await moduleGraph?.ensureEntryFromUrl(unwrapId(options.id), this.ssr) // Not all options passed to this function make sense in the context of loading individual files, // but we can at least update the module info properties we support updateModuleInfo(options.id, options)