MagicMirror² v2.7.0 is available! For more information about this release, check out this topic.

Add further npm dependencies to basic MM installation


  • Project Sponsor

    Hi all,
    this goes esp. to @MichMich but of course like to discuss with all @Module-Developers

    If I understand correctly, for npm dependencies to be used by module fiels there are basically two options

    • use what is in the MagicMirror/vendor (like moment.js) folder
    • have it installed via npm install in a node_modules folder of the module and set a link in the module file.

    Now there are some npm dependencies that are used in more than one 3rd party module.
    E.g.

    • I am using chart.js in three different modules a.t.m.
    • I have seen google-translate-api being used several times.

    Can’t we include these to the general MM installation and have them present only once and net in every in every module’s subfolder?
    I understand that we might not want to blow up the basic MM installation but I also think there are some trends for usage of certain npm modules.


  • Module Developer

    @lavolp3
    I want to recommend ‘iconify’ instead font-awesome, it include fa and more than that nonetheless its not related with npm.
    https://iconify.design


  • Admin

    The problem is I don’t want to bloat the basic installation. (Looking back I prefer to not have any additional vendors at all).

    And how would we select which dependencies we include in MM and which dependencies we don’t?

    What would be a great feature, is to allow a module to specify the rpm modules it requires and let MM install them on startup if they are not currently available. 🙂


  • Project Sponsor

    @michmich said in Add further npm dependencies to basic MM installation:

    And how would we select which dependencies we include in MM and which dependencies we don’t?

    Well that is obviously a case-by-case decision and therefore a bit tricky, I admit.
    But from these two I’m sure they are valuable to the MM environment.

    • A Google translation API (which tbh needs to be chosen carefully because one on npm is currently not working unfortunately)

    • A Charting tool.

    So why not use them? It’s “only” a few JS files.
    However, it’s your decision and I fully respect your point.