-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
feat: use module runner to import the config #18637
base: main
Are you sure you want to change the base?
Conversation
fa4e6dd
to
3965409
Compare
Probably the test are failing because we support |
This looks similar to what Astro has been doing, which starts up the Vite server and Question: Does the module runner handle CJS config files well?
I'd honestly love if we start to not support them 😅 Separately from this PR, maybe we should start warning if we see them and suggest using |
Good catch! We can inject it with a different evaluator. |
Hm, module runner only supports ESM. Injecting To support a CJS config, we need to reimplement most of vite-node's "mix cjs-esm" code. Unless we forbid CJS altogether 😄 |
Description
Very rough idea to use the module runner instead of
esbuild.build
. Some advantages:Benchmarking the
vitest.config.ts
file in the root:resolveConfig
to construct a simple resolved config (environment requires a config, we can construct a small one just for this environment since we control all private plugins)init
plugin containerrunner.import
AsyncFunction
ssrTransform
esbuild
Overall the new approach takes ~28-32ms and the old one takes ~14-22ms, but resolving the config is not a hot path fortunetly. We can also shave off 5-6ms if we provide a dummy config