Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Type 'FriendlyErrorsWebpackPlugin' is not assignable to type 'WebpackPluginInstance'. #130

Description

@liyiming22
"@types/friendly-errors-webpack-plugin": "0.1.3",
"@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "3.11.1",
"@types/webpack-merge": "^5.0.0",

"webpack-cli": "^4.3.1",
"webpack-dev-server": "^3.11.2",
"webpack-merge": "^5.7.3",
"webpackbar": "^5.0.0-3"

"friendly-errors-webpack-plugin": "^1.7.0",
"typescript": "^4.1.3",

configuration

const commonConfig: Configuration = {
  ......
  ......
  plugins: [
    new WebpackBar({
      name: 'Project',
      // react blue
      color: '#61dafb',
    }),
    new FriendlyErrorsPlugin(),
    new HtmlWebpackPlugin({
      minify: __DEV__ ? false : htmlMiniFierOptions,
      cache: false,
      template: path.resolve(PROJECT_ROOT, './public/index.html')
    }),
    // new HardSourceWebpackPlugin()
  ]
}

Got this error:

error TS2322: Type 'FriendlyErrorsWebpackPlugin' is not assignable to type '((this: Compiler, compiler: Compiler) => void) | WebpackPluginInstance'.
  Type 'FriendlyErrorsWebpackPlugin' is not assignable to type 'WebpackPluginInstance'.
    Types of property 'apply' are incompatible.
      Type '(compiler: import("/Users/liyiming22/ts-react/node_modules/@types/friendly-errors-webpack-plugin/node_modules/@types/webpack/index").Compiler) => void' is not assignable to type '(compiler: import("/Users/liyiming22/ts-react/node_modules/webpack/types").Compiler) => void'.
        Types of parameters 'compiler' and 'compiler' are incompatible.
          Property '_pluginCompat' is missing in type 'import("/Users/liyiming22/ts-react/node_modules/webpack/types").Compiler' but required in type 'import("/Users/liyiming22/ts-react/node_modules/@types/friendly-errors-webpack-plugin/node_modules/@types/webpack/index").Compiler'.

116     new FriendlyErrorsPlugin(),
        ~~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/@types/friendly-errors-webpack-plugin/node_modules/@types/webpack/index.d.ts:1466:9
    1466         _pluginCompat: SyncBailHook<compilation.Compilation>;
                 ~~~~~~~~~~~~~
    '_pluginCompat' is declared here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions