feat: support for self-referencing#16068
Conversation
|
|
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI on
✅ astro, histoire, ladle, laravel, marko, previewjs, qwik, rakkas, sveltekit, unocss, vike, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-pages, vite-plugin-react-swc, vite-plugin-svelte, vite-plugin-vue, vite-setup-catalogue, vitepress, vitest |
bluwy
left a comment
There was a problem hiding this comment.
Awesome work! Did a few tests locally and it seems to handle all the edge cases. I'm not sure why Nuxt is failing, but I triggered a rerun for it.
|
📝 Ran ecosystem CI on
✅ astro, histoire, ladle, laravel, marko, nuxt, previewjs, qwik, rakkas, sveltekit, unocss, vike, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-pages, vite-plugin-react-swc, vite-plugin-svelte, vite-plugin-vue, vite-setup-catalogue, vitepress, vitest |
| // check if it's a self reference dep. | ||
| const selfPackageData = findNearestPackageData(basedir, packageCache) | ||
| pkg = | ||
| selfPackageData?.data.exports && selfPackageData?.data.name === pkgId | ||
| ? selfPackageData | ||
| : null | ||
| } | ||
| return | ||
| if (!pkg) return |
There was a problem hiding this comment.
I think this code should be before const pkg = resolvePackageData(pkgId, basedir, preserveSymlinks, packageCache).
PACKAGE_SELF_RESOLVE (9.) is called before the resolution loop (11.).
https://nodejs.org/api/esm.html#resolution-algorithm:~:text=Let%20selfUrl%20be%20the%20result%20of%20PACKAGE_SELF_RESOLVE(packageName%2C%20packageSubpath%2C%20parentURL).
It only affects a case when you have a dep with the same name though.
There was a problem hiding this comment.
Makes sense, already updated
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI on
✅ astro, histoire, ladle, laravel, marko, nuxt, previewjs, qwik, rakkas, sveltekit, unocss, vike, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-pages, vite-plugin-react-swc, vite-plugin-svelte, vite-plugin-vue, vite-setup-catalogue, vitepress, vitest |
Description
fix: #9731
Additional context
Support for
self-referencingseems to be in line with expectations in terms of functionality, but I'm not sure if there's anything else that needs to be considered.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).