@@ -51,33 +51,90 @@ export default defineConfig({
5151 server : {
5252 fs : { strict : false } ,
5353 } ,
54+ optimizeDeps : {
55+ // Do not prebundle compiler-rs: its WASI browser entry resolves a sibling
56+ // .wasm file, and prebundling rewrites that URL to node_modules/.vite/deps.
57+ exclude : [
58+ "@astrojs/compiler-binding" ,
59+ "@astrojs/compiler-binding-wasm32-wasi" ,
60+ "@astrojs/compiler-rs" ,
61+ ] ,
62+ } ,
5463 resolve : {
55- alias : {
56- "astro-eslint-parser" : path . join (
57- dirname ,
58- "./docs-build/shim/astro-eslint-parser.mjs" ,
59- ) ,
60- "eslint-plugin-jsx-a11y" : path . join (
61- dirname ,
62- "./docs-build/shim/eslint-plugin-jsx-a11y.mjs" ,
63- ) ,
64+ alias : [
65+ {
66+ find : "eslint-plugin-jsx-a11y" ,
67+ replacement : path . join (
68+ dirname ,
69+ "./docs-build/shim/eslint-plugin-jsx-a11y.mjs" ,
70+ ) ,
71+ } ,
6472 // node
65- url : path . join ( dirname , "./docs-build/shim/url.mjs" ) ,
66- module : path . join ( dirname , "./docs-build/shim/module.mjs" ) ,
67- "node:url" : path . join ( dirname , "./docs-build/shim/url.mjs" ) ,
68- "node:module" : path . join ( dirname , "./docs-build/shim/module.mjs" ) ,
69- "fast-glob" : path . join ( dirname , "./docs-build/shim/fast-glob.mjs" ) ,
70- tinyglobby : path . join ( dirname , "./docs-build/shim/tinyglobby.mjs" ) ,
73+ {
74+ find : "url" ,
75+ replacement : path . join ( dirname , "./docs-build/shim/url.mjs" ) ,
76+ } ,
77+ {
78+ find : "module" ,
79+ replacement : path . join ( dirname , "./docs-build/shim/module.mjs" ) ,
80+ } ,
81+ {
82+ find : "node:url" ,
83+ replacement : path . join ( dirname , "./docs-build/shim/url.mjs" ) ,
84+ } ,
85+ {
86+ find : "node:module" ,
87+ replacement : path . join ( dirname , "./docs-build/shim/module.mjs" ) ,
88+ } ,
89+ {
90+ find : "fast-glob" ,
91+ replacement : path . join ( dirname , "./docs-build/shim/fast-glob.mjs" ) ,
92+ } ,
93+ {
94+ find : "tinyglobby" ,
95+ replacement : path . join ( dirname , "./docs-build/shim/tinyglobby.mjs" ) ,
96+ } ,
7197 // override tsconfig (it had no effect...)
72- "@eslint-community/eslint-utils" : path . join (
73- dirname ,
74- "./node_modules/@eslint-community/eslint-utils" ,
75- ) ,
76- "node:path" : path . join (
77- dirname ,
78- "./node_modules/vite-plugin-eslint4b/shim/path-shim.mjs" ,
79- ) ,
80- } ,
98+ {
99+ find : "@eslint-community/eslint-utils" ,
100+ replacement : path . join (
101+ dirname ,
102+ "./node_modules/@eslint-community/eslint-utils" ,
103+ ) ,
104+ } ,
105+ {
106+ find : "node:path" ,
107+ replacement : path . join (
108+ dirname ,
109+ "./node_modules/vite-plugin-eslint4b/shim/path-shim.mjs" ,
110+ ) ,
111+ } ,
112+ // Force compiler-rs onto its browser binding; the default binding
113+ // imports node:module and native .node packages.
114+ {
115+ find : "@astrojs/compiler-binding" ,
116+ replacement : path . join (
117+ dirname ,
118+ "./node_modules/@astrojs/compiler-binding/browser.js" ,
119+ ) ,
120+ } ,
121+ // The wasm32-wasi binding is optional for Node installs, so the explorer
122+ // carries it directly and aliases exact imports to its browser files.
123+ {
124+ find : / ^ @ a s t r o j s \/ c o m p i l e r - b i n d i n g - w a s m 3 2 - w a s i $ / ,
125+ replacement : path . join (
126+ dirname ,
127+ "./node_modules/@astrojs/compiler-binding-wasm32-wasi/astro.wasi-browser.js" ,
128+ ) ,
129+ } ,
130+ {
131+ find : / ^ @ a s t r o j s \/ c o m p i l e r - b i n d i n g - w a s m 3 2 - w a s i \/ w a s i - w o r k e r - b r o w s e r \. m j s $ / ,
132+ replacement : path . join (
133+ dirname ,
134+ "./node_modules/@astrojs/compiler-binding-wasm32-wasi/wasi-worker-browser.mjs" ,
135+ ) ,
136+ } ,
137+ ] ,
81138 } ,
82139 plugins : [
83140 eslint4b ( ) ,
0 commit comments