Javascript.NodeJS icon indicating copy to clipboard operation
Javascript.NodeJS copied to clipboard

Is there a option to use import/export syntax?

Open entropin opened this issue 1 year ago • 0 comments

Hi I have built some javascript using vue and Vite (ES modules), I'm trying to use Javascript.NodeJs to run the server-side rendering part of the javascript on our IIS Server.

cmd Node handles the file just fine, also using c# and Process Start() and pointing Node to the file path works. I just need to add a package.json and specifically enable modules. But I can't find a way to run the script using this lib. Is there a way?

Am about to give up, but found this comment:

"ES6 modules (import/export syntax) are experimental in the latest Node.js version (v14.4.0): nodejs.org/api/esm.html. To enable it, you can pass special arguments to Node.js or add an element to your package.json - refer to the Node.js docs enabling section for details. Documentation on passing arguments to Node.js through Jering.Javascript.Nodejs: github.com/JeringTech/Javascript.NodeJS#nodejsprocessoptions."

But I can't see a way to run it, we are using Node 18, can this script be run without having to use Bable to transpile? Any pointers?

entropin avatar Sep 06 '22 19:09 entropin