Clearscript: V8 enable modules

Created on 15 May 2019  路  8Comments  路  Source: microsoft/ClearScript

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.

enhancement fixed

Most helpful comment

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!

All 8 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!

ClearScript 5.6 includes basic support for modules.

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

import ScriptClass1 from "ScriptClass1.js";

Hi @Ariohor,

Take a look at the test method here.

Good luck!

袩褉懈胁械褌 @Ariohor ,

袩芯褋屑芯褌褉懈褌械 薪邪 屑械褌芯写 懈褋锌褘褌邪薪懈泄 蟹写械褋褜 .

校写邪褔懈!

Thank you very much!

I have a follow up question on this,
What's the best way to import modules installed using NPM in visual studio? I have a package.json file that installs the dependencies in a node_modules folder.

Hi @karimi,

You can use DocumentSettings.SearchPath to specify your module locations.

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.

Was this page helpful?
0 / 5 - 0 ratings