-
Notifications
You must be signed in to change notification settings - Fork 17
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
Untracable error messages from beyond short-circuitted load hooks #163
Comments
What version of Node.js are you using? |
@aduh95 21.1 now when i'm encountering it again.
without context. A few files get passed forward to the default nextLoad, |
actually inserting a re-parse/serialization in the load hook to get usable stack trace wasn't a big issue and it solved my problem, but the fact that i have to parse each file an additional time only because there's no way to trace or catch errors from shortCircuits is what seems wasteful. |
I've been quite lost for a few days not knowing where a SyntaxError was coming from in a module's import graph,
as I'm compiling typescript imports by returning {source:output,shortCircuit:true,format:"module"} from
load
,and all I saw was
thrown at the entry import of the typescript module graph.
I logged every compiled source code along with the specifier argument before the shortCircuit to spot which file's final modularization was throwing that syntax error.
Since there is no control over what happens beyond the load hook, would it be possible to simply disclose the specifiers in the error messages coming from there, or otherwise figure out a way to catch them somehow after emerging from load hooks with a shortCircuit?
The first one could be easy peasy, for the second the only solution i can imagine is exposing a "modularize" hook where one could customize the interpretation of the source code with the "vm" module. Which wouldn't be half bad in itself, but also one doesn't exclude the other either (more informative logging in the default modularization "hook", wether it ever gets exposed as "nextModularize" or not).
The text was updated successfully, but these errors were encountered: