0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-20 22:12:38 -05:00

fix: provide a plugin to resolve the virtual module (#11242)

This commit is contained in:
Emanuele Stoppa 2024-06-12 11:28:26 +01:00 committed by GitHub
parent 769f11f23f
commit e4fc2a0baf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a case where the virtual module `astro:container` wasn't resolved

View file

@ -0,0 +1,15 @@
import type * as vite from 'vite';
const virtualModuleId = 'astro:container';
export default function astroContainer(): vite.Plugin {
return {
name: 'astro:container',
enforce: 'pre',
resolveId(id) {
if (id === virtualModuleId) {
return this.resolve('astro/virtual-modules/container.js');
}
},
};
}

View file

@ -38,6 +38,7 @@ import { createViteLogger } from './logger/vite.js';
import { vitePluginMiddleware } from './middleware/vite-plugin.js';
import { joinPaths } from './path.js';
import { isObject } from './util.js';
import astroContainer from "../container/vite-plugin-container.js";
interface CreateViteOptions {
settings: AstroSettings;
@ -157,6 +158,7 @@ export async function createVite(
astroDevToolbar({ settings, logger }),
vitePluginFileURL({}),
astroInternationalization({ settings }),
astroContainer()
],
publicDir: fileURLToPath(settings.config.publicDir),
root: fileURLToPath(settings.config.root),

1
pnpm-lock.yaml generated
View file

@ -9575,7 +9575,6 @@ packages:
libsql@0.3.12:
resolution: {integrity: sha512-to30hj8O3DjS97wpbKN6ERZ8k66MN1IaOfFLR6oHqd25GMiPJ/ZX0VaZ7w+TsPmxcFS3p71qArj/hiedCyvXCg==}
cpu: [x64, arm64, wasm32]
os: [darwin, linux, win32]
lilconfig@2.1.0: