@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';
~~~~~~~~~~~
@types/html-webpack-plugin
包并且遇到了问题。Definitions by:
中的index.d.ts
)所以他们可以回应。如果您不提及作者,该问题将被忽略。
安装html-webpack-plugin@next
以与包含类型定义本身的webpack@5兼容。
最新的html-webpack-plugin
(v4.5.0) 已经有了自己的类型定义,并且已经支持 webpack 5。无需安装@types/html-webpack-plugin
我在 webpack5 和 ts 上遇到了同样的问题,你解决这个问题了吗?
最有用的评论
最新的
html-webpack-plugin
(v4.5.0) 已经有了自己的类型定义,并且已经支持 webpack 5。无需安装@types/html-webpack-plugin