Now that Electron has hit Chrome's 60s we can have proper module support. But of course, the standard (for very good reasons) prevents loading modules from file:
and it makes sense for both Electron and NW.js to adhere to the statusquo.
So if you were really excited and this bums you, don't worry, you are in for awesome things.
The future Electron eco-system offers two options for native ES modules:
-
Custom Electron protocol via Chromium's module loading subsystem
-
Custom NodeJS loaders via Node's module loading subsystem recommended
Both methods can coexist. In fact, so far from tests, it seems that at least for hybrid applications, using both methods together will be the more suitable path.
This focuses on the first.
Revision: Draft 2
@bobjunga ah, been a long time, but per my past understanding, the approach is similar to @jarek-foksa's comments from before which was through
registerFileProtocol
(or something else maybe) andregisterSchemeAsPrivileged
but following current examples.This has to do with browser layers for security on standard schemes, which likely still applies today, but I could be mistaken.
That's as much as I am able at this point to trust would likely work, but I have not worked with electron since 2019.
Hope this helps :)