-
-
Notifications
You must be signed in to change notification settings - Fork 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
refactor: migrate to exsolve
for module resolution
#13513
Conversation
|
@@ -9,8 +7,7 @@ import { pathToFileURL } from 'node:url'; | |||
*/ | |||
export async function resolve_peer_dependency(dependency) { | |||
try { | |||
// @ts-expect-error the types are wrong | |||
const resolved = imr.resolve(dependency, pathToFileURL(process.cwd() + '/dummy.js')); | |||
const resolved = resolveModuleURL(dependency); |
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.
we could use { try: true }
here also to avoid try/catch situation, however I didn't want to make too much changes.
This code is simpler, which is nice. I don't understand why that is and if we're deviating more from the I think we'd drop either library as a dependency in SvelteKit 3 (#13528) |
Thank you. I would prefer to keep things as they are, since when we're able to switch to |
Totally fine if you like to keep things as is, I just wanted to offer a better option n in meantime (it is simpler usage and 20kb less install size I found a reason to make PR while was inspecting svelte-kit install size). Also, a note might be worth considering, Usage of |
This PR migrates
import-meta-resolve
to unjs/exsolve which is actively maintained and has features such as global cache to improve performance.Note: exsolve utils default to resolving from CWD which I noticed was the case for both usages here.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.Edits