Read the statement by Michael Teeuw here.
Module Ability to Add Packages to Vendor Directory
-
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
-
@MMRIZE , yes, your getScripts function suggestion worked! Thanks!
-
- 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
orpostinstall
scripts for your module to handle that kind of job (additional install, move/rename files, etc.)
-
@MMRIZE , yes, your getScripts function suggestion worked! Thanks!