Importing JavaScript from other file/npm package throws error #170
-
Hey there! I've been trying to migrate my project from J2V8 to Javet for a while now. However a bit of a snag I've hit is that when I try to import JS code from another file/from a package such as axios, Javet throws an error along the lines of:
I'm just wondering if this could be something I'm doing wrong or if Javet doesn't support this or if it could be something different entirely. I've read through the documentation and other issues/discussions to try to find an answer to no avail. I'd be happy to share more code if needed to. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
May I know which mode you are using? V8 ModeYou need to register a module resolver via Node.js ModeYou need to follow some rules to make it work. Please refer to #148 for detail. |
Beta Was this translation helpful? Give feedback.
-
I have the same problem. With the difference that I have to add a module not just single file . Thank you for your guidance. |
Beta Was this translation helpful? Give feedback.
May I know which mode you are using?
V8 Mode
You need to register a module resolver via
v8Runtime.setV8ModuleResolver(...)
. Please refer to this test suite for detail.Node.js Mode
You need to follow some rules to make it work. Please refer to #148 for detail.