-
-
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: support for self-referencing #16068
feat: support for self-referencing #16068
Conversation
Run & review this pull request in StackBlitz Codeflow. |
/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 |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
Thanks!
Description
fix: #9731
Additional context
Support for
self-referencing
seems 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
).