Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

--watch crashes upon @rollup/plugin-typescript check failure #4986

Open
dead-claudia opened this issue May 10, 2023 · 5 comments
Open

--watch crashes upon @rollup/plugin-typescript check failure #4986

dead-claudia opened this issue May 10, 2023 · 5 comments

Comments

@dead-claudia
Copy link

dead-claudia commented May 10, 2023

Rollup Version

3.21.6

Operating System (or Browser)

Debian 11 Bullseye and Ubuntu 22.04.2 Jammy, run inside WSL 2 (WSL 1.2.5.0, kernel 5.15.90.1) under Windows 10

Node Version (if applicable)

v16.20.0 in Debian and Ubuntu, v20.1.0 in Ubuntu

Link To Reproduction

https://github.com/dead-claudia/rollup-type-crash, https://github.com/dead-claudia/rollup-unused-crash

Expected Behaviour

This is a family of highly related bugs, and the two links are for two different sets of test cases. Here's the expectation with each type of bug:

  • Invalid to invalid: process to remain alive and print resulting error
  • Valid to invalid: process to remain alive and print resulting error
  • Invalid to valid: dist.js to be created/updated

Actual Behaviour

  • Invalid to invalid: process crashes, silently in Node 16 but with output in Node 20
  • Valid to invalid: process crashes, silently in Node 16 but with output in Node 20
  • Invalid to valid: dist.js is not generated, even if you touch it after the initial correction

The error generated by Node v20.1.0 is this:

node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received an instance of Error
    at process.set [as exitCode] (node:internal/bootstrap/node:124:9)
    at process.exit (node:internal/process/per_thread:188:24)
    at process.close (/home/claudia/rollup-typescript-silent-crash/node_modules/rollup/dist/shared/watch-cli.js:543:19) {
  code: 'ERR_INVALID_ARG_TYPE'
}

The README details each one of these in full.

@dead-claudia
Copy link
Author

Filed rollup/plugins#1491 to track it on the plugin side, in case it's just a plugin issue (unlikely, but I can't rule it out).

@dead-claudia
Copy link
Author

Here's everything I tried to mitigate, each to no avail:

  • Installing with clean npm caches using --cache
  • Restarting the Debian VM in WSL, to check for kernel state issues
  • Creating a new throwaway Ubuntu VM in WSL, to fully isolate the kernel's state

The issue in question is a family of highly related errors. The reason they're split is because I did a few times have the type variant (but not the unused variant) report an actual TS error before exiting, but I wasn't able to easily isolate it while putting together this repro. I also suspect it's just a minor variation of the same issue.

Let me know if you need anything else.

@lukastaegert
Copy link
Member

There was indeed one issue in the error handling in Rollup that swallows "uncaught" errors. #4987 should fix this, giving you the proper error. Beyond that, I would be doubtful if the error is really within Rollup, but let's see.

@dead-claudia
Copy link
Author

There was indeed one issue in the error handling in Rollup that swallows "uncaught" errors. #4987 should fix this, giving you the proper error. Beyond that, I would be doubtful if the error is really within Rollup, but let's see.

@lukastaegert Question: does that address the issue of bad input to process.exit/process.exitCode that Node 20 complained about?

@lukastaegert
Copy link
Member

lukastaegert commented May 10, 2023

Exactly, that is the issue it addresses. It was accidentally passing the error as the exit code for the uncaughtException event. Which leads me to believe that there is an uncaught exception, but I did not run your test case yet.

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

No branches or pull requests

2 participants