tsconfig-paths-webpack-plugin icon indicating copy to clipboard operation
tsconfig-paths-webpack-plugin copied to clipboard

strange index import/exports result to improper commonjs type definition exports

Open Hotell opened this issue 7 years ago • 0 comments

currently it's not possible to properly import this plugin via commonjs within .js file when checkJs:true because generated type definitions provide wrong ambient export

instead of

image

we should get

image

So this will compile without any errors within webpack.config.js

// @ts-check
const TsconfigPathsPlugin = /** @type {any} */ (require('tsconfig-paths-webpack-plugin'))
// ....
{
 plugins: [new TsconfigPathsPlugin()],
}

I mean you cannot use import {} from '...' within webpack ( nodejs ) but if you're writing plugins etc in TypeScript import is gonna be supported as TS understands export = TsconfigPathsPlugin

Current Behaviour:

image

Hotell avatar Sep 20 '18 14:09 Hotell