-
-
Notifications
You must be signed in to change notification settings - Fork 247
Description
Current behavior
Error in fork-ts-checker-webpack-plugin after an error occurs outside of fork-ts-checker-webpack-plugin. I had a legitimate error in my postcss config file, which was causing the build to bail early. When this happens, I get the following error.
/Users/jonathan/my-app/node_modules/fork-ts-checker-webpack-plugin/lib/index.js:459
return this.serviceRpc.dispatch(message);
^
TypeError: Cannot read property 'dispatch' of undefined
at ChildProcess.service.on.message (/Users/jonathan/my-app/node_modules/fork-ts-checker-webpack-plugin/lib/index.js:459:36)
at ChildProcess.emit (events.js:189:13)
at emit (internal/child_process.js:820:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
I'm not familiar with fork-ts-checker-webpack-plugin, but it appears a spawned service is receiving a message after shutting down.
Expected behavior
Don't fail when a message is received after the service is killed.
Steps to reproduce the issue
Forcing an error in postcss.config.js reproduces the error for me, but I imagine forcing an error in any other loader may also reproduce the error.
Note
The fix likely entails adding a null check to the this.serviceRpc!.dispatch
call, since the RPC provider dispatches in promise.resolve
callbacks and doesn't appear to have a way to tear itself down.
Environment
- fork-ts-checker-webpack-plugin: 3.1.0
- typescript: 3.6.4
- tslint: 5.16.0
- webpack: 4.30.0
- os: macOS 10.15.1