File tree Expand file tree Collapse file tree 2 files changed +23
-22
lines changed
packages/vitest-pool-workers/src Expand file tree Collapse file tree 2 files changed +23
-22
lines changed Original file line number Diff line number Diff line change @@ -156,28 +156,28 @@ function createConfigPlugin(): Plugin<WorkersConfigPluginAPI> {
156156 config . ssr . target = "webworker" ;
157157
158158 // Pre-bundling dependencies with vite
159- // @see https://github.com/flarelabs-net/vite-plugin-cloudflare/blob/2e2bde62f9a729f26bbaf768840ded3393f994b8/packages/vite-plugin-cloudflare/src/cloudflare-environment.ts#L153-L176
160- config . ssr . optimizeDeps = {
161- noDiscovery : false ,
162- exclude : [
163- ...cloudflareBuiltInModules ,
164- ...builtinModules . concat ( builtinModules . map ( ( m ) => `node:${ m } ` ) ) ,
159+ config . test . deps ??= { } ;
160+ config . test . deps . optimizer ??= { } ;
161+ config . test . deps . optimizer . ssr ??= { } ;
162+ config . test . deps . optimizer . ssr . enabled = true ;
163+ config . test . deps . optimizer . ssr . exclude = [
164+ ...cloudflareBuiltInModules ,
165+ ...builtinModules . concat ( builtinModules . map ( ( m ) => `node:${ m } ` ) ) ,
166+ ] ;
167+ config . test . deps . optimizer . ssr . esbuildOptions = {
168+ platform : "neutral" ,
169+ resolveExtensions : [
170+ ".mjs" ,
171+ ".js" ,
172+ ".mts" ,
173+ ".ts" ,
174+ ".jsx" ,
175+ ".tsx" ,
176+ ".json" ,
177+ ".cjs" ,
178+ ".cts" ,
179+ ".ctx" ,
165180 ] ,
166- esbuildOptions : {
167- platform : "neutral" ,
168- resolveExtensions : [
169- ".mjs" ,
170- ".js" ,
171- ".mts" ,
172- ".ts" ,
173- ".jsx" ,
174- ".tsx" ,
175- ".json" ,
176- ".cjs" ,
177- ".cts" ,
178- ".ctx" ,
179- ] ,
180- } ,
181181 } ;
182182
183183 // Ideally, we would force `pool` to be @cloudflare/vitest-pool-workers here,
Original file line number Diff line number Diff line change @@ -323,7 +323,8 @@ async function viteResolve(
323323 // (Specifically, the "tinyrainbow" module imports `node:tty` as `tty`)
324324 return id ;
325325 }
326- return resolved . id ;
326+ // strip off deps optimization hash from vite
327+ return resolved . id . split ( "v=" ) [ 0 ] ;
327328}
328329
329330type ResolveMethod = "import" | "require" ;
You can’t perform that action at this time.
0 commit comments