From 6fcaab84de1044ff4d186b2dfa5831964460062d Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Sun, 25 Aug 2024 20:23:07 +0800 Subject: [PATCH] Make vite-plugin-fileurl a pre plugin (#11822) --- .changeset/fuzzy-falcons-tan.md | 5 +++++ packages/astro/src/core/create-vite.ts | 2 +- packages/astro/src/vite-plugin-fileurl/index.ts | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/fuzzy-falcons-tan.md diff --git a/.changeset/fuzzy-falcons-tan.md b/.changeset/fuzzy-falcons-tan.md new file mode 100644 index 0000000000000..45323269d56ef --- /dev/null +++ b/.changeset/fuzzy-falcons-tan.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Marks internal `vite-plugin-fileurl` plugin with `enforce: 'pre'` diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index 23a4068a8bda3..7fbfe60ddd717 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -151,7 +151,7 @@ export async function createVite( astroPrefetch({ settings }), astroTransitions({ settings }), astroDevToolbar({ settings, logger }), - vitePluginFileURL({}), + vitePluginFileURL(), astroInternationalization({ settings }), settings.config.experimental.serverIslands && vitePluginServerIslands({ settings }), astroContainer(), diff --git a/packages/astro/src/vite-plugin-fileurl/index.ts b/packages/astro/src/vite-plugin-fileurl/index.ts index 4a14323a07597..73132f3af979f 100644 --- a/packages/astro/src/vite-plugin-fileurl/index.ts +++ b/packages/astro/src/vite-plugin-fileurl/index.ts @@ -1,8 +1,9 @@ import type { Plugin as VitePlugin } from 'vite'; -export default function vitePluginFileURL({}): VitePlugin { +export default function vitePluginFileURL(): VitePlugin { return { name: 'astro:vite-plugin-file-url', + enforce: 'pre', resolveId(source, importer) { if (source.startsWith('file://')) { const rest = source.slice(7);