-
Notifications
You must be signed in to change notification settings - Fork 150
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
V8 enable modules #114
Comments
Hi @fasihrana, ClearScript currently doesn't support ES6 modules. We're evaluating adding support for both ES6 and Node.js-style modules in an upcoming release. Thanks! |
…y, GitHub Issue #114); added initial support for CommonJS modules (V8 and JScript); added ScriptEngine.ExecuteDocument and ScriptEngine.EvaluateDocument; added V8ScriptEngine.CompileDocument and V8Runtime.CompileDocument; added support for machine-level deployment (GitHub Issue #117); added Extensions and JavaScriptExtensions to facilitate specific scenarios; added implicit conversion of host method arguments via user-defined operators (GitHub Issue #115); patched a V8 issue that causes occasional script execution failure in 32-bit processes (GitHub Issue #111); fixed accessibility of public methods overriden by internal classes (GitHub Issue #112); updated deployment and API documentation. Tested with V8 7.6.303.28.
ClearScript 5.6 includes basic support for modules. |
Can you please show an example how to enable import/export in ClearScript? We try to use modules but allways return one error "SyntaxError: Unexpected identifier" in code
|
I have a follow up question on this, |
Hi @karimi, You can use Please let us know if you need additional information. Good luck! |
Thanks, that's what I was looking for. I also had to have a build event that copies the node_modules to my build folder. |
I have a question, public JsonResult CreatePPT(string JSONToPass, string VisualInfo) {
} the JS script doesn't run returns an Error : "require is not defined" NOTE: I have used require to use installed npm packages |
Hi @pp2110, The var info = new DocumentInfo { Category = ModuleCategory.CommonJS };
engine.Execute(info, script); Note however that ClearScript provides a bare JavaScript environment containing only the JavaScript built-ins It does not implement the Web or Node.js APIs. |
Is there a way to enable "import <module>.js;" statements in a V8 Runtime?
I couldn't find any examples and makes me think I'd have to parse the script file myself first to enable this.
As on StackOverflow.
The text was updated successfully, but these errors were encountered: