Read the statement by Michael Teeuw here.
ES6 notation
-
@sdetweil Thanks Sam. Is there any plan that it would one day be possible? Certain helper modules, newer versions that is, only supports ES6 notation. If we don’t move along with the times then we may get stuck in the “dark ages” so to say.
Older versions have security vulnerabilities etc.
-
@mumblebaj
You can use “import()”, but need some tricks.- wait enough time to finish importing
- or use promise to confirm loading finishes.
I used that trick in my MMM-Scenes module to import modular mjs instead of global injections.
-
@mumblebaj i am not in the loop on the plans for future MM designs, details…
best to open an issue and ask Mich
-
@mumblebaj
Ref this; https://forum.magicmirror.builders/topic/15761/best-practice-for-import-esm-in-mm-module?_=1662569185624It was for front mm module, but you can apply in the node_helper also. (Easier, because you don’t need to wait dom creation to inject script in node_helper, just do finish importing confirmation before first work begins in your start() method, or at least before using that module.)
-