Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Errors when compiling a Webpack config written in TypeScript #81

Closed
astorije-vmware opened this issue Nov 19, 2021 · 2 comments
Closed

Comments

@astorije-vmware
Copy link

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:

  • node: 14.17.3
  • yarn: 1.22.17
  • webpack: 5.63.0
  • webpack-build-notifier: 2.3.0
  • ts-loader: 9.2.6
  • typescript: 4.4.4

* 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
Copy link
Owner

RoccoC commented Dec 1, 2021

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
Copy link
Owner

RoccoC commented May 27, 2024

Fixed in #91 and #92.

@RoccoC RoccoC closed this as completed May 27, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants