dividab / tsconfig-paths-webpack-plugin

Load modules according to tsconfig paths in webpack.
MIT License
596 stars 51 forks source link

`mainFields` type mismatch with webpack #88

Closed aaronadamsCA closed 2 years ago

aaronadamsCA commented 2 years ago

This plugin:

https://github.com/dividab/tsconfig-paths-webpack-plugin/blob/cb0f1dd86f9ca12818703ccbff13f7121ce210d6/src/options.ts#L12

Webpack:

https://github.com/webpack/webpack/blob/2738eebc7880835d88c727d364ad37f3ec557593/types.d.ts#L9718

mainFields?: (string | string[])[];

This causes a type mismatch when forwarding config.resolve.mainFields to this plugin:

image

It might be preferable to directly pass through the types of mainFields (and extensions) directly from webpack. Alternatively, typing them as unknown would prevent type checking altogether, which seems acceptable in this pass-through scenario.