Skip to content

Commit ec0b024

Browse files
authoredJan 29, 2025··
vite: Fix astro dev server page load error by marking cssesc as external in the vite-node server (#1535)

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
 

‎.changeset/tame-hornets-turn.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/integration': patch
3+
---
4+
5+
Fixes an error that sometimes occurred when loading a page via the astro dev server

‎packages/integration/src/compiler.ts

+5
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ const createViteServer = async ({
110110
},
111111
ssr: {
112112
noExternal: true,
113+
// `cssesc` is CJS-only, so we need to mark it as external as Vite's transform pipeline
114+
// can't handle CJS during dev-time.
115+
// See https://github.com/withastro/astro/blob/0879cc2ce7e15a2e7330c68d6667d9a2edea52ab/packages/astro/src/core/create-vite.ts#L86
116+
// and https://github.com/withastro/astro/issues/11395
117+
external: ['cssesc'],
113118
},
114119
plugins: [
115120
{

0 commit comments

Comments
 (0)
Please sign in to comment.