ChakraCore icon indicating copy to clipboard operation
ChakraCore copied to clipboard

How can I import and use a module from file

Open Uefi1 opened this issue 3 years ago • 1 comments

Hello, how can I import and use a module from file ????

Memo1.Lines.Text:=Engine.ConvertToString(Engine.RunScript('import * as customName from ("./myjs/MyNode.js");'));

Error $30002: JavaScript failed to compile.
Name: SyntaxError
Message: 'import' or 'export' can only be used in module code.
Source: import * as customName from ("./myjs/MyNode.js");
Line: 0
Column: 0

Uefi1 avatar Jul 19 '22 04:07 Uefi1

I'm not sure how Chakracore is being invoked in this example, I assume this is via some kind of wrapper tool?

I would need more information about the intermediate layer you're using in order to help.

rhuanjl avatar Sep 29 '22 22:09 rhuanjl