-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing buildStart
behavior with createServer
API
#19607
Comments
vite/packages/vite/src/node/server/pluginContainer.ts Lines 1083 to 1084 in d0aa833
I think we need to keep this compat for now.
I think that's because we're missing vite/packages/vite/src/node/server/pluginContainer.ts Lines 1086 to 1100 in d0aa833
I think we can fix this way instead. |
Not sure exactly why yet, but my scripts (that I run using TypeError: injectConfigValues is not a function
at TransformPluginContext.transform
[at](plugin: 'vite:client-inject')
return defineReplacer(injectConfigValues(code));
^ so, it seems like it would be fixed by the PR above. I haven't figured out exactly what change caused this error to start appearing, but it seems to be a dependency update. |
@rChaoz This one is supposed to be fixed (worked around) on vite-node side vitest-dev/vitest#7480. Do you have latest vite-node 3.0.8? |
Describe the bug
Vite-node has been using a following style of programmatic server setup https://github.com/vitest-dev/vitest/blob/94b27af595b5029b6201a7bcf2702169fe7ae6a4/packages/vite-node/src/cli.ts#L86-L99, but I'm not sure whether
buildStart
should be manually triggered on Vite 6 (also howperEnvironmentStartEndDuringDev
should be enabled on server level or plugin level).One issue with manually calling
buildStart
is that:which causes
transform
to happen beforebuildStart
finishes:Probably this was the cause of vitest-dev/vitest#7479 and this can potentially break
vite:client-inject
since itstransform
relies onbuildStart
vite/packages/vite/src/node/plugins/clientInjections.ts
Line 102 in 7e7b660
On the other hand, one issue with not manually calling
buildStart
is that this breaks css import like in #19606.Reproduction
https://stackblitz.com/github/hi-ogawa/reproductions/tree/main/vite-19598-ssr-only-css?file=repro1.js
Steps to reproduce
node repro1.js
node repro2.js
System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.20.3 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: vite: ^6.2.0 => 6.2.1
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: