You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the extensionAlias option is set to resolve TypeScript files (e.g. { ".js": [".ts", ".js"] },) enhanced-resolve tries to resolve subpath exports of external packages using the .ts file extension first and fails without trying the .js file extension.
Impact
This prevents the use of Webpack in projects that enables ES modules and TypeScript and uses external packages with subpath exports in their exports fields.
Error message
> npm run build
> webpack-exports-extension-alias@1.0.0 build
> webpack
assets by status 872 bytes [cached] 5 assets
./src/index.ts 43 bytes [built] [code generated]
ERROR in ./src/index.ts 1:0-42
Module not found: Error: Package path ./string.ts is not exported from package /Users/raviqqe/src/github.com/raviqqe/til/webpack-exports-extension-alias/node_modules/@raviqqe/hidash (see exports field in /Users/raviqqe/src/github.com/raviqqe/til/webpack-exports-extension-alias/node_modules/@raviqqe/hidash/package.json)
webpack 5.80.0 compiled with 1 error in 606 ms
Is this caused by the plugin order in the ResolverFactory?
The text was updated successfully, but these errors were encountered:
raviqqe
changed the title
Use of extensionAlias fails resolution of subpath exports in exports fields in a package
Use of extensionAlias fails resolution of subpath exports in exports fields
Apr 25, 2023
Problem
When the
extensionAlias
option is set to resolve TypeScript files (e.g.{ ".js": [".ts", ".js"] }
,)enhanced-resolve
tries to resolve subpath exports of external packages using the.ts
file extension first and fails without trying the.js
file extension.Impact
This prevents the use of Webpack in projects that enables ES modules and TypeScript and uses external packages with subpath exports in their
exports
fields.Error message
package.json
in an example external package:Minimal reproducible example
Environment
enhanced-resolve
: 5.13.0webpack
: 5.80.0ts-loader
: 9.4.2Notes
Is this caused by the plugin order in the
ResolverFactory
?The text was updated successfully, but these errors were encountered: