My environment consists in Webpack 4.16, React 16.4, TypeScript 3.3 and AntDesign 3.13
Everything works fine, I can import each component from AntD in order to optimize better my files and the final size.
I'm also using webpack-bundle-analyzer to check the size for each import I'm doing.
My problem is a warning that I'm getting on my editor:
How to add my node_modules libs in order to not get the warning? Why is it working even without finding the module?
UPDATE 1
In order to understand it better, I'm applying some WebPack configurations to see if has any results:
const getResolves = {
extensions: ['.ts', '.js', '.tsx', '.less'],
modules: ['src/less', 'src/ts', 'src', 'node_modules'],
alias: {
antd: path.resolve(__dirname, './node_modules/antd'),
}
};
I tried to add an alias to antd lib. It works normally like before, but the warning is still there.
UPDATE 2
Good news! I could found a way to make it work and this post is updated with an answer. I will let the question open in order to see if anyone else has a different approach or a better explanation about it.
Thanks!
I found a solution presented by this guy here: https://github.com/Microsoft/vscode/issues/25312#issuecomment-449609664
I just added a new property "moduleResolution": "node" to my tsconfig file.
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": "./src",
"moduleResolution": "node",
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "es6",
"target": "es5",
"jsx": "react",
"allowJs": true
},
"exclude": [
"node_modules"
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With