Skip to content

Allow ./node_modules passthrough in paths#224

Merged
sandersn merged 2 commits intomasterfrom
allow-node_modules_passthrough-in-paths
Mar 29, 2021
Merged

Allow ./node_modules passthrough in paths#224
sandersn merged 2 commits intomasterfrom
allow-node_modules_passthrough-in-paths

Conversation

@sandersn
Copy link
Copy Markdown
Member

I introduced a node_modules passthrough in webpack in DefinitelyTyped/DefinitelyTyped#51712: the entire index.d.ts is

import webpack = require('./node_modules/webpack')
export = webpack

This allows @types/webpack@5 to delegate its entire type definition to webpack@5, while still allowing @types/webpack@4 to be maintained on DT.

However, the correct module specifier is actually just 'webpack', since there's no guarantee of the exact location where webpack will be installed. This can be made to compile on DT with a path mapping:

"paths": {
    "webpack": [
        "./node_modules/webpack"
    ]
}

Previously, path mappings like this were not allowed. This PR allows them, of the form packageName: ["./node_modules/" + packageName].

I introduced a node_modules passthrough in webpack in
DefinitelyTyped/DefinitelyTyped#51712: the entire index.d.ts is

```ts
import webpack = require('./node_modules/webpack')
export = webpack
```

This allows @types/webpack@5 to delegate its entire type definition to
webpack@5, while still allowing @types/webpack@4 to be maintained on
DT.

However, the correct module specifier is actually just 'webpack', since
there's no guarantee of the exact location where webpack will be
installed. This can be made to compile on DT with a path mapping:

```json
"paths": {
    "webpack": [
        "./node_modules/webpack"
    ]
}
```

Previously, path mappings like this were not allowed. This PR allows
them.
@sandersn sandersn merged commit 8cdbe73 into master Mar 29, 2021
@sandersn sandersn deleted the allow-node_modules_passthrough-in-paths branch March 29, 2021 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant