nodemon-webpack-plugin: Typescript errors with Webpack 5

Webpack 5 (5.0.0-beta.16) does not export Plugin, which cause type-checking and builds to fail with:

node_modules/nodemon-webpack-plugin/dist/index.d.ts:3:12 - error TS2459: Module '"......./node_modules/webpack/types"' declares 'Plugin' locally, but it is not exported.

3   import { Plugin } from 'webpack';
             ~~~~~~

  node_modules/webpack/types.d.ts:5126:19
    5126 declare interface Plugin {
                           ~~~~~~
    'Plugin' is declared here.

node_modules/schema-utils/declarations/validate.d.ts:2:34 - error TS2307: Cannot find module 'json-schema'.

2 export type JSONSchema4 = import('json-schema').JSONSchema4;
                                   ~~~~~~~~~~~~~

node_modules/webpack/types.d.ts:62:8 - error TS2307: Cannot find module 'estree'.

62 } from "estree";

Related:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 27 (14 by maintainers)

Most upvoted comments

The typings issue was declared by the WebPack team as a breaking change between v4 and v5.

We have two options:

  1. Split the plugin.
  2. Create our own types (like html-webpack-plugin did).

Second option seems far more reasonable to me.

Will attempt fix in due course.