Definitelytyped: [@types/html-webpack-plugin] 支持 webpack 5

创建于 2020-10-15  ·  3评论  ·  资料来源: DefinitelyTyped/DefinitelyTyped

@types/html-webpack-plugin 不支持现在由 webpack 本身生成的 webpack 5 类型。

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';
                   ~~~~~~~~~~~
  • [x] 我尝试使用@types/html-webpack-plugin包并且遇到了问题。
  • [x] 我尝试使用最新的稳定版 tsc。 https://www.npmjs.com/package/typescript
  • [x] 我有一个不适合StackOverflow 的问题。 (请在那里提出任何适当的问题)。
  • [x] [提及](https://github.com/blog/821-mention-somebody-they-re-notified) 作者(见Definitions by:中的index.d.ts )所以他们可以回应。

    • 作者: @deevus@bumbleblym 、@tlaziuk

如果您不提及作者,该问题将被忽略。

最有用的评论

最新的html-webpack-plugin (v4.5.0) 已经有了自己的类型定义,并且已经支持 webpack 5。无需安装@types/html-webpack-plugin

所有3条评论

安装html-webpack-plugin@next以与包含类型定义本身的webpack@5兼容。

最新的html-webpack-plugin (v4.5.0) 已经有了自己的类型定义,并且已经支持 webpack 5。无需安装@types/html-webpack-plugin

我在 webpack5 和 ts 上遇到了同样的问题,你解决这个问题了吗?

此页面是否有帮助?
0 / 5 - 0 等级