-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript issue - Type 'Resolver' is missing the following properties from type 'Resolver': apply, plugints(2322) #61
Comments
Turns out that the Webpack 5 is coming with integrated types, and that is the issue - the definition for the Resolver type inside the plugin conflicts with the one webpack provides. The Resolver type is not exported, so I'm not sure how one would implement the Resolver plugin with definitions for Webpack 5. |
@high1 I've had some success going on little fishing expeditions for unexported webpack types. For example, the following seems to work: import { NormalModule } from 'webpack';
type ResolverWithOptions = Pick<Parameters<NormalModule['createLoaderContext']>, 0>; |
@rsimoes can you elaborate on how you're using I have this same issue, but I'm having no luck with the workaround of disabling ts-lint, I do that and instead get a second error,:
Failing that, can anyone suggest an alternative to TsconfigPathsPlugin. FWIW and for anyone running into the same issue, this came about for me after installing |
@brett-east This module is going to need more separated implementation pieces for Webpack 5. Quite a bit of the API has changed, sadly. |
@rsimoes A lot of ecosystem has not caught up with the latest Webpack, so a lot of plugins depend on Webpack 4 types, and it's honestly a mess - not sure if it's worth pursuing Webpack 5 typed configurations for now actually. |
Use this version without prefixing it with '^', untill someone writes patch for this types problem. |
Webpack has it's types integrated in version 5, and mixing previous and current types results in a mess, that's why I switched to pure JS for now. |
"devDependencies": {
"@types/node": "^14.14.28",
"image-minimizer-webpack-plugin": "^2.2.0",
"ts-loader": "^8.0.17",
"tsconfig-paths-webpack-plugin": "^3.3.0",
"typescript": "^4.1.5",
"webpack": "^5.22.0"
} Forces me to do this const webpackConfig: webpack.Configuration = {
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
plugins: [
new TsconfigPathsPlugin({
configFile: "./tsconfig.json",
}) as any,
]
},
} Note the |
Rather than |
Hello, after updating deps, I'm getting this error in my webpack typescript configuration:
My guess is that there's an issue with never version of webpack type definitions - the one giving me issue here are "@types/webpack": "^4.41.25",.
The workaround for now is to disable typescript and eslint, and the plugin still works.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
The text was updated successfully, but these errors were encountered: