require(esm)
error caught by try/catch
also generates unhandled rejection
#56267
Labels
esm
Issues and PRs related to the ECMAScript Modules implementation.
Version
v22.12.0
Platform
Subsystem
No response
What steps will reproduce the bug?
reproduction: https://github.com/hi-ogawa/reproductions/tree/main/node-require-esm-error-try-catch
Given two files:
running
node reqire-esm.cjs
shows a followingHow often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
I'm not entirely sure the semantics of require(esm) and top level errors, but I'd expect there's no unhandled rejection.
What do you see instead?
unhandled rejection
Additional information
I was checking odd issues with tailwind config loading in vitejs/vite#18969 and ended up with the minimal repro here to confirm whether the current behavior is intended. I think it's somewhat common to use
try/catch
withrequire
with some fallback and tailwind seems to do so.The text was updated successfully, but these errors were encountered: