Let's say @workspace/lib is a package in a loal NPM Workspace.
By default, imports will be resolved to node_modules/@workspace/lib, but we can change its resolution by defining the following path mapping:
"paths": {
"@workspace/lib": "./dist/lib"
}
By doing so, TypeScript will always resolve the path @workspace/lib to {workspaceRoot}/dist/lib instead of {workspaceRoot}/node_modules/@workspace/lib, but this behavior doesn't seem respected in this library: In such case, the path mapping does not take effect, and the path @workspace/lib is not transformed at all.
I will be happy to provide a reproduction repository if you find the above information not descriptive enough.
Update: the path mapping is respected if @workspace/lib is not present in package.json. This package was listed as a peer dependency to enable auto-imports.
Let's say
@workspace/lib
is a package in a loal NPM Workspace.By default, imports will be resolved to
node_modules/@workspace/lib
, but we can change its resolution by defining the following path mapping:By doing so, TypeScript will always resolve the path
@workspace/lib
to{workspaceRoot}/dist/lib
instead of{workspaceRoot}/node_modules/@workspace/lib
, but this behavior doesn't seem respected in this library: In such case, the path mapping does not take effect, and the path@workspace/lib
is not transformed at all.I will be happy to provide a reproduction repository if you find the above information not descriptive enough.