diff --git a/README.md b/README.md index a45e58c..b287381 100644 --- a/README.md +++ b/README.md @@ -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
- `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
- `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. diff --git a/src/tests/imports_field.rs b/src/tests/imports_field.rs index 017647d..a186629 100644 --- a/src/tests/imports_field.rs +++ b/src/tests/imports_field.rs @@ -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")); +}