Skip to content
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

fix(es/loader): Fix the absolute path check when resolving modules #10080

Merged
merged 7 commits into from
Feb 23, 2025

Conversation

CPunisher
Copy link
Member

@CPunisher CPunisher commented Feb 22, 2025

fixes: #9854

if !module_specifier.starts_with('.') is true when module_specifier is neither a relative path nor an absolute path like classnames, then the file in current working directory will be found.

I gave up adding a test because it needs to change the current working directory (by calling std::env::set_current_dir), which causes failures of other tests.

Another changed line of code is to align with https://www.typescriptlang.org/docs/handbook/modules/reference.html#baseurl, which says:

The baseUrl compiler option can be combined with any moduleResolution mode and specifies a directory that bare specifiers (module specifiers that don’t begin with ./, ../, or /) are resolved from

@CPunisher CPunisher requested a review from a team as a code owner February 22, 2025 07:23
Copy link

changeset-bot bot commented Feb 22, 2025

🦋 Changeset detected

Latest commit: 444c984

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CPunisher CPunisher changed the title fix(es/loader): fix(es/loader): Fix the absolute path check when resolving modules Feb 22, 2025
@CPunisher CPunisher marked this pull request as draft February 22, 2025 07:54
Copy link

codspeed-hq bot commented Feb 22, 2025

CodSpeed Performance Report

Merging #10080 will degrade performances by 5.69%

Comparing CPunisher:02-21-fix/module-resolve-1 (444c984) with main (a883cdc)

Summary

❌ 1 regressions
✅ 190 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
es/minifier/libs/moment 82.8 ms 87.8 ms -5.69%

@CPunisher CPunisher marked this pull request as ready for review February 22, 2025 08:47
@kdy1 kdy1 requested a review from a team as a code owner February 23, 2025 01:46
@kdy1 kdy1 added this to the Planned milestone Feb 23, 2025
@kdy1 kdy1 merged commit a3894ae into swc-project:main Feb 23, 2025
17 checks passed
@kdy1 kdy1 modified the milestones: Planned, v1.11.1 Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

SWC transpiles node_module import to root TS file of the same name
2 participants