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
Problem description.
Hello!
I'm rewriting my app from common js to es6 modules. So I have to move from loadFileSync to async loadFile to import my schemas and resolvers. The problem I've encountered is that if you have any troubles with your imports within resolvers, you get the error, on this line:
Import fails due to errors in code and fallback to require. Obviously require is not defined cause I'm using es6 modules. I've spent some time figuring out what's wrong, cause error really doesn't help much to locate a problem.
The solution that helped me:
Simply added console.log of error thrown by import fail and got all the problems causing that:
Request:
Make import fail errors more clear and informable.
Question:
Why fallback to require anyway, as using import with es6 modules will always lead to undefined require error? I'm a beginner programmer so the question is really to learn and understand. Thanks for your reply in advance.
The text was updated successfully, but these errors were encountered:
Problem description.
Hello!
I'm rewriting my app from common js to es6 modules. So I have to move from loadFileSync to async loadFile to import my schemas and resolvers. The problem I've encountered is that if you have any troubles with your imports within resolvers, you get the error, on this line:
Import fails due to errors in code and fallback to require. Obviously require is not defined cause I'm using es6 modules. I've spent some time figuring out what's wrong, cause error really doesn't help much to locate a problem.
The solution that helped me:
Simply added console.log of error thrown by import fail and got all the problems causing that:
Request:
Make import fail errors more clear and informable.
Question:
Why fallback to
require
anyway, as using import with es6 modules will always lead toundefined require
error? I'm a beginner programmer so the question is really to learn and understand. Thanks for your reply in advance.The text was updated successfully, but these errors were encountered: