Skip to content
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

[@types/terser-webpack-plugin] Support for webpack 5 #48806

Closed
3 tasks done
rajzik opened this issue Oct 15, 2020 · 5 comments · Fixed by #49314
Closed
3 tasks done

[@types/terser-webpack-plugin] Support for webpack 5 #48806

rajzik opened this issue Oct 15, 2020 · 5 comments · Fixed by #49314

Comments

@rajzik
Copy link

rajzik commented Oct 15, 2020

@types/terser-webpack-plugin doesn't support webpack 5 types which are now generated by webpack itself.

node_modules/@types/terser-webpack-plugin/index.d.ts:7:10 - error TS2305: Module '"../../webpack/types"' has no exported member 'Plugin'.

7 import { Plugin } from 'webpack';
           ~~~~~~
@Danscho
Copy link
Contributor

Danscho commented Oct 16, 2020

@peterblazejewicz already created a pull request.
Please see: #48794.
This should resolve your issue.

@isellsoap
Copy link

isellsoap commented Oct 20, 2020

I have another error message popping up in the webpack config file, when using terser-webpack-plugin 5.0.0 with webpack 5:

Type 'TerserPlugin' is not assignable to type '"..." | WebpackPluginInstance | ((this: Compiler, compiler: Compiler) => void)'.
  Type 'TerserPlugin' is not assignable to type '(this: Compiler, compiler: Compiler) => void'.
    Type 'TerserPlugin' provides no match for the signature '(this: Compiler, compiler: Compiler): void'.ts(2322)

Anyone else having this issue?

@buschtoens
Copy link
Contributor

buschtoens commented Nov 2, 2020

From what I can tell the issue is that the latest version of @types/terser-webpack-plugin, even after #48794, still specifies @types/webpack@* as dependency, which resolves to wepack@4.41.21. It seems that this dependency is somehow added implicitly by @DefinitelyTyped, as I can't find it in the package.json. Do we maybe have to add webpack@5 as a dependency to prevent this?

webpack@5 also doesn't export Plugin any more, but e.g. WebpackPluginInstance.

buschtoens added a commit to buschtoens/DefinitelyTyped that referenced this issue Nov 2, 2020
@rajzik
Copy link
Author

rajzik commented Nov 2, 2020

@buschtoens
#48857
there was same issue with webpack 5.

@echochens
Copy link

Have any guys solved the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants