Hi,
I am quite new to js dev and am trying to work out what is possible in NW.js with respect to ES6 modules. As the status/support of ES6 modules - especially in regard to node.js dev - seems to be in a state of flux recently (last year or so) a lot of the information around the place seems to be out of date.
I am wondering, is it possible to use ES6 modules for my nw.js app. Currently I have a html entry point and importing my mjs source with a script tag with type="module". Seems to parse ok, but a simple:
import * as worker from 'worker_threads';
Results in the error:
Uncaught TypeError: Failed to resolve module specifier "worker_threads". Relative references must start with either "/", "./", or "../".
It seems like I can import a local file with ES6 import syntax ok.
I have also been playing around with Electron which has certain odd restrictions which modules can be imported with import/require so I am wondering if I am doing something wrong or there are certain fundamental restrictions with importing. I would have thought being based on recent node versions that import of built-in node modules with ES6 syntax would be possible.