You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Cannot find module 'unknown' from '/home/ericmorand/Projects/module-deps-test'
Except by parsing the error message, which is not a serious option - and even this way I would not be able to get the file name, I can't find a way to retrieve the file where the error happened.
I thought that I would be able to catch the correct file by registering to the file event like this:
constmdeps=require('module-deps');constmd=mdeps();letcurrentFile;md.on('file',(file)=>{currentFile=file;});md.on('error',(e)=>{console.warn(currentFile);// will print ./partialconsole.warn(e);});md.end({file:'./main.js'});
But the currentFile contains ./partial.js because it is the latest file encountered successfully by module-deps. And it is not where the error happens.
Can someone point me to the solution?
The text was updated successfully, but these errors were encountered:
I don't think we have a way to do this right now, but i'd be open to adding info properties like .specifier ('unknown') and .source ('module-deps-test/main.js') or something to resolution errors to make them more useful.
I'm trying to retrieve the file where an error occurred and all I'm able to catch is a standard JavaScript error with a message but not file.
For example:
The error thrown is:
Except by parsing the error message, which is not a serious option - and even this way I would not be able to get the file name, I can't find a way to retrieve the file where the error happened.
I thought that I would be able to catch the correct file by registering to the
file
event like this:But the
currentFile
contains./partial.js
because it is the latest file encountered successfully by module-deps. And it is not where the error happens.Can someone point me to the solution?
The text was updated successfully, but these errors were encountered: