MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    ES6 notation

    Scheduled Pinned Locked Moved Development
    7 Posts 3 Posters 1.1k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sdetweil @mumblebaj
      last edited by

      @mumblebaj i don’t think its available in MM

      by default the filetype mjs can use import
      BUT mm does require(‘node_helper.js’)

      js/app.js

                      const helperPath = `${moduleFolder}/node_helper.js`;
                              const Module = require(helperPath);
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      mumblebajM 1 Reply Last reply Reply Quote 0
      • mumblebajM Offline
        mumblebaj Module Developer @sdetweil
        last edited by

        @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.

        Check out my modules at: https://github.com/mumblebaj?tab=repositories
        Check my blog-post: https://mumblebaj.xyz/

        S 1 Reply Last reply Reply Quote 0
        • M Offline
          MMRIZE @mumblebaj
          last edited by

          @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.

          1 Reply Last reply Reply Quote 1
          • S Offline
            sdetweil @mumblebaj
            last edited by

            @mumblebaj i am not in the loop on the plans for future MM designs, details…

            best to open an issue and ask Mich

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • M Offline
              MMRIZE @mumblebaj
              last edited by MMRIZE

              @mumblebaj
              Ref this; https://forum.magicmirror.builders/topic/15761/best-practice-for-import-esm-in-mm-module?_=1662569185624

              It 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.)

              mumblebajM 1 Reply Last reply Reply Quote 0
              • mumblebajM Offline
                mumblebaj Module Developer @MMRIZE
                last edited by

                @MMRIZE and @sdetweil Thanks guys, Thought I would put the question out there and see what crawls out the woodwork. ;-)

                Check out my modules at: https://github.com/mumblebaj?tab=repositories
                Check my blog-post: https://mumblebaj.xyz/

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Enjoying MagicMirror? Please consider a donation!
                MagicMirror created by Michael Teeuw.
                Forum managed by Sam, technical setup by Karsten.
                This forum is using NodeBB as its core | Contributors
                Contact | Privacy Policy