RoccoC / webpack-build-notifier

A Webpack plugin that generates OS notifications for build steps using node-notifier.
MIT License
162 stars 24 forks source link

Errors when compiling a Webpack config written in TypeScript #81

Closed astorije-vmware closed 5 months ago

astorije-vmware commented 2 years ago

I don't have a minimal repro config at the moment, but it seems like when compiling a Webpack config file from TS to JS* using tsc --build, the following errors appear:

node_modules/webpack-build-notifier/dist/types.d.ts:59:44 - error TS2724: 'exports' has no exported member named 'compiler'. Did you mean 'Compiler'?

59     onCompileStart?: (compilation: webpack.compiler.Compiler) => void;
                                              ~~~~~~~~

node_modules/webpack-build-notifier/dist/types.d.ts:65:40 - error TS2724: 'exports' has no exported member named 'compilation'. Did you mean 'Compilation'?

65     onComplete?: (compilation: webpack.compilation.Compilation, status: CompilationStatus) => void;

I also had to install @types/node-notifier on my repo to silence a few errors (I'm happy to post them as well), which is super weird, but at least it was easy to fix.

Is there any workaround I could use?

Versions:


* Context is that we have a shared Webpack config for all our repositories, that we write in TypeScript, then compile into a regular JS package.

RoccoC commented 2 years ago

Hmm, so I suspect the issue is that webpack-build-notifier depends on webpack@4.x and your project is dependent upon webpack@5.x, and there is a type discrepancy between versions.

Regardless, I don't think your TS build should be transpiling (or type-checking) the webpack-build-notifier package. Does your tsconfig exclude node_modules?

RoccoC commented 5 months ago

Fixed in #91 and #92.