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/html-webpack-plugin] Support for webpack 5 #48804

Closed
4 tasks done
rajzik opened this issue Oct 15, 2020 · 4 comments
Closed
4 tasks done

[@types/html-webpack-plugin] Support for webpack 5 #48804

rajzik opened this issue Oct 15, 2020 · 4 comments

Comments

@rajzik
Copy link

rajzik commented Oct 15, 2020

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

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

9 import { Plugin, compilation, Compiler } from 'webpack';
           ~~~~~~

node_modules/@types/html-webpack-plugin/index.d.ts:9:18 - error TS2724: Module '"../../webpack/types"' has no exported member 'compilation'. Did you mean 'Compilation'?

9 import { Plugin, compilation, Compiler } from 'webpack';
                   ~~~~~~~~~~~

If you do not mention the authors the issue will be ignored.

@fwh1990
Copy link

fwh1990 commented Nov 2, 2020

Install html-webpack-plugin@next to compatible with webpack@5 that includes type definition itself.

@latipun7
Copy link
Contributor

latipun7 commented Nov 2, 2020

latest html-webpack-plugin (v4.5.0) already has its own type definition, and already support webpack 5. No need to install @types/html-webpack-plugin

@rajzik rajzik closed this as completed Nov 2, 2020
@lanmch
Copy link

lanmch commented Nov 4, 2020

i meet the same problem with webpack5 and ts, hav you solve this problem?

@maverick-zhn
Copy link

maverick-zhn commented Nov 29, 2020

I had the same issue even with the html-webpack-plugin (v4.5.0.) In my case, I changed just the typings.d.ts:
This
import { Compiler, compilation } from 'webpack';
to this:
import { Compiler, Compilation } from 'webpack';
and
static getHooks(compilation: compilation.Compilation): HtmlWebpackPlugin.Hooks;
to
static getHooks(compilation: Compilation): HtmlWebpackPlugin.Hooks;
I am not sure if this is the intended behavior though. Thanks.

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

No branches or pull requests

5 participants