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.

    Module Ability to Add Packages to Vendor Directory

    Scheduled Pinned Locked Moved Solved Feature Requests
    3 Posts 3 Posters 535 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.
    • T Offline
      td
      last edited by

      Hello!

      I am posting this here, but I am not sure if this feature already exists in some way or another.
      As I developed the Magic Mirror module MMM-GConnect (https://github.com/tderflinger/MMM-GConnect) I wanted to use the Preact (https://preactjs.com/) library to make my UI programming more efficient for me. Preact is basically a lightweight version of the popular React library.

      The only way to make Preact work in my module was to install it in the vendor directory and add a reference in vendor/vendor.js.

      The thing now is when users of my module want to install MMM-GConnect, they need to manually install Preact and add the lines to vendor/vendor.js.

      Is there a standard way to do that in Magic Mirror that I am not aware of? If not, I would propose to add a feature to make it possible for modules to add packages to vendor automatically as part of their install routine.

      Thanks for your opinion!

      -Thomas

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

        @MMRIZE , yes, your getScripts function suggestion worked! Thanks!

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

          @td

          • This doesn’t work?
          getScripts: function () {
            return [ 
              this.file('node_modules/preact/dist/preact.min.js'), //from this module's directory
            ]
          }
          
          • Or you can serve preinstall or postinstall scripts for your module to handle that kind of job (additional install, move/rename files, etc.)
          T 1 Reply Last reply Reply Quote 1
          • T Offline
            td @MMRIZE
            last edited by

            @MMRIZE , yes, your getScripts function suggestion worked! Thanks!

            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