Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ The options are aligned with [enhanced-resolve](https://github.com/webpack/enhan

### Other Options

| Field | Default | Description |
| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tsconfig | None | TypeScript related config for resolver |
| tsconfig.configFile | | A relative path to the tsconfig file based on `cwd`, or an absolute path of tsconfig file. |
| tsconfig.references | `[]` | - 'auto': inherits from TypeScript config <br/> - `string []`: relative path (based on directory of the referencing tsconfig file) or absolute path of referenced project's tsconfig |
| enablePnp | false | Enable Yarn Plug'n'Play support |
| Field | Default | Description |
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| tsconfig | None | TypeScript related config for resolver |
| tsconfig.configFile | | A relative path to the tsconfig file based on `cwd`, or an absolute path of tsconfig file. |
| tsconfig.references | `[]` | - 'auto': inherits from TypeScript config <br/> - `string []`: relative path (based on directory of the referencing tsconfig file) or absolute path of referenced project's tsconfig |
| enablePnp | false | Enable Yarn Plug'n'Play support |

In the context of `@rspack/resolver`, the `tsconfig.references` option helps isolate the `paths` configurations of different TypeScript projects.
This ensures that path aliases defined in one TypeScript project do not unintentionally affect the resolving behavior of another.
Expand Down
17 changes: 17 additions & 0 deletions src/tests/imports_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1339,3 +1339,20 @@ async fn test_cases() {
}
}
}

#[tokio::test]
#[ignore] // imports chain not supported yet
async fn test_imports_chain() {
let root = super::fixture().join("imports-field-chain");
let resolved = Resolver::default().resolve(&root, "#a").await.unwrap().path;

assert_eq!(resolved, root.join("the.js"))
}

#[tokio::test]
async fn test_imports_chain_to_other_package() {
let root = super::fixture().join("imports-field");
let resolved = Resolver::default().resolve(&root, "#c").await.unwrap().path;

assert_eq!(resolved, root.join("node_modules/c/index.js"));
}
Loading