-
-
Notifications
You must be signed in to change notification settings - Fork 7k
feat(ssr): support import.meta.resolve
in module runner
#20260
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
base: main
Are you sure you want to change the base?
feat(ssr): support import.meta.resolve
in module runner
#20260
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat idea!
/ecosystem-ci run |
commit: |
📝 Ran ecosystem CI on
✅ analogjs, astro, laravel, ladle, quasar, sveltekit, storybook, one, qwik, unocss, rakkas, vite-plugin-pwa, marko, vite-plugin-svelte, vite-setup-catalogue, vite-plugin-vue, vite-plugin-react, vuepress, vitest, vitepress |
/ecosystem-ci run |
📝 Ran ecosystem CI on
✅ nuxt, analogjs, one, quasar, astro, marko, laravel, ladle, qwik, storybook, vite-environment-examples, unocss, vite-plugin-react, vite-plugin-svelte, rakkas, vite-plugin-pwa, vite-plugin-vue, vite-setup-catalogue, vitest, sveltekit, vuepress, vitepress |
Cloudflare is still failing. I don't think this is breaking the fundamental behavior, but probably they have strict check which don't expect |
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
I added a |
/ecosystem-ci run |
📝 Ran ecosystem CI on
✅ ladle, one, rakkas, astro, unocss, marko, analogjs, laravel, qwik, quasar, storybook, sveltekit, nuxt, vite-plugin-svelte, vite-plugin-pwa, vite-plugin-vue, vite-environment-examples, vite-plugin-cloudflare, vitepress, vuepress, vitest, vite-setup-catalogue, vite-plugin-react |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Description
This PR adds
import.meta.resolve
support to the module runner.I recently encountered a similar problem and came up with this idea, so I implemented to see if it works 😀
This approach only works in Node as it relies on 1. module customization hooks, 2. the second parameter of
import.meta.resolve
. But I don't think there's a way to avoid "2" and then that limitation is impossible to avoid. Because of "2", vitest-dev/vitest#5188 only works in Node as well.The upside of this approach compared to vitest-dev/vitest#5188 is that this approach does not require users to pass
--experimental-import-meta-resolve
.refs vitest-dev/vitest#6953
refs vitest-dev/vitest#5188