Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: give a specific error for matched alias not found #238

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

underfin
Copy link
Contributor

@underfin underfin commented Sep 3, 2024

The vite resolver alias has a case like this { '/@vite/env': '/@fs/xxx' }, it could be work because the the rollup aliasPlugin not checked the /@fs/xxx could be resolved. But the oxc resolver will do check it, here the oxc resolver always give a error with Module Not Found, it is difficult to see the reasons.

I tested the enhanced-resolver, it will give the helpful msg to check. See it

error: Can't resolve '/@vite/env' in '/Users/likui/Github/resolver-test'
    at finishWithoutResolve (/Users/likui/Github/resolver-test/node_modules/.pnpm/enhanced-resolve@5.17.1/node_modules/enhanced-resolve/lib/Resolver.js:564:18)
    at /Users/likui/Github/resolver-test/node_modules/.pnpm/enhanced-resolve@5.17.1/node_modules/enhanced-resolve/lib/Resolver.js:656:15
    at /Users/likui/Github/resolver-test/node_modules/.pnpm/enhanced-resolve@5.17.1/node_modules/enhanced-resolve/lib/Resolver.js:718:5
    at eval (eval at create (/Users/likui/Github/resolver-test/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /Users/likui/Github/resolver-test/node_modules/.pnpm/enhanced-resolve@5.17.1/node_modules/enhanced-resolve/lib/Resolver.js:718:5
    at eval (eval at create (/Users/likui/Github/resolver-test/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /Users/likui/Github/resolver-test/node_modules/.pnpm/enhanced-resolve@5.17.1/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:89:43
    at /Users/likui/Github/resolver-test/node_modules/.pnpm/enhanced-resolve@5.17.1/node_modules/enhanced-resolve/lib/Resolver.js:718:5
    at eval (eval at create (/Users/likui/Github/resolver-test/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /Users/likui/Github/resolver-test/node_modules/.pnpm/enhanced-resolve@5.17.1/node_modules/enhanced-resolve/lib/Resolver.js:718:5 {
  details: "resolve '/@vite/env' in '/Users/likui/Github/resolver-test'\n" +
    '  using description file: /Users/likui/Github/resolver-test/package.json (relative path: .)\n' +
    "    aliased with mapping '/@vite/env': '/@fs/nc' to '/@fs/nc'\n" +
    '      using description file: /Users/likui/Github/resolver-test/package.json (relative path: .)\n' +
    '        No description file found in /@fs or above\n' +
    '        no extension\n' +
    "          /@fs/nc doesn't exist\n" +
    '        .js\n' +
    "          /@fs/nc.js doesn't exist\n" +
    '        .json\n' +
    "          /@fs/nc.json doesn't exist\n" +
    '        .node\n' +
    "          /@fs/nc.node doesn't exist\n" +
    '        as directory\n' +
    "          /@fs/nc doesn't exist"

Here add an ResolveError::MatchedAliasNotFound error to make alais resolve error msg clear to find the reasons.

@Boshen Boshen changed the title feat: give an specific error for matched alias not found feat: give a specific error for matched alias not found Sep 3, 2024
Copy link

codspeed-hq bot commented Sep 3, 2024

CodSpeed Performance Report

Merging #238 will not alter performance

Comparing underfin:imporve-alais-not-found-error (59b1a68) with main (5b71e9c)

Summary

✅ 3 untouched benchmarks

@Boshen Boshen merged commit 3953cdd into oxc-project:main Sep 3, 2024
18 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants