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:
parent
769f11f23f
commit
e4fc2a0baf
4 changed files with 22 additions and 1 deletions
5
.changeset/fair-wasps-hunt.md
Normal file
5
.changeset/fair-wasps-hunt.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixes a case where the virtual module `astro:container` wasn't resolved
|
15
packages/astro/src/container/vite-plugin-container.ts
Normal file
15
packages/astro/src/container/vite-plugin-container.ts
Normal 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');
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
|
@ -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
1
pnpm-lock.yaml
generated
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue