简体   繁体   English

类型错误:this._extensions.close 不是 webpack 中的函数

[英]TypeError: this._extensions.close is not a function in webpack

To avoid TypeError: this.htmlWebpackPlugin.getHooks is not a function.为了避免 TypeError: this.htmlWebpackPlugin.getHooks 不是一个函数。 When using使用时

    var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');

    new InterpolateHtmlPlugin(HtmlWebPackPlugin, {
      PUBLIC_URL: '/public',
    }),...

I upgraded "html-webpack-plugin" to "^4.0.0-beta.11" as recommended by https://github.com/facebook/create-react-app/issues/5465#issuecomment-438270664我按照https://github.com/facebook/create-react-app/issues/5465#issuecomment-438270664 的建议将“html-webpack-plugin”升级为“^4.0.0-beta.11”

And then I got this error 'TypeError: this._extensions.close is not a function'.然后我收到了这个错误“TypeError: this._extensions.close is not a function”。

You will have this issue when you are running on webpack-dev-server.当你在 webpack-dev-server 上运行时你会遇到这个问题。 Uninstall the previous version of webpack-dev-server (also remove it from package.json) and install the latest version of webpack-dev-server.卸载之前版本的 webpack-dev-server(也从 package.json 中删除)并安装最新版本的 webpack-dev-server。 That solved it for me.那为我解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM