swc/crates/swc_ecma_loader/tests
xiao xin d6a4615898
fix(es/loader): Make tsc resolver work for bare specifier (#8550)
**Description:**

From the typescript
[baseUrl](https://www.typescriptlang.org/docs/handbook/modules/reference.html#baseurl)
doc: When using bare specifiers (module specifiers that don’t begin with
./, ../, or /), baseUrl has a higher precedence than node_modules
package lookups.

In the current tsc resolver implementation, when resolving bare module
specifiers, baseUrl was not used except for `paths`, this cause the
belowing resolution failed, but it worked when used in typescript
project.

`tsconfig.json` / `.swcrc`:
```json
{
    baseUrl: "."
    paths: {
        "@common/*": ["src/common/*"]
    }
}
```

File structure:
- ./src/common/helper.ts
- ./src/index.ts


./src/index.ts content:
```ts
 // tsc can resolve this, but tsc resolver cannot
import sth from "src/common/helper"
```
2024-01-27 04:56:11 +00:00
..
basic_import/node_modules/jquery fix(es/loader): Fix traversal of node modules resolver (#4327) 2022-04-13 19:51:17 +00:00
browser_overwrite/node_modules/jquery fix(es/loader): Fix browser overwrites not applying correctly (#7243) 2023-04-14 23:48:22 +00:00
hoisting chore(repo): Configure prettier (#4523) 2022-05-04 14:25:28 +00:00
.gitignore fix(es/loader): Fix traversal of node modules resolver (#4327) 2022-04-13 19:51:17 +00:00
node_resolver.rs fix(es/module): Fix resolving of dependencies (#8533) 2024-01-21 21:35:57 +09:00
tsc_resolver.rs fix(es/loader): Make tsc resolver work for bare specifier (#8550) 2024-01-27 04:56:11 +00:00