Including npm package in extension

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • czcpf
    Senior Member
    • Aug 2022
    • 160

    Including npm package in extension

    Hello,

    I'm building an extension for espoCRM using the expocrm/ext-template from Github https://github.com/espocrm/ext-template

    I would like to include this npm package in my extension: https://github.com/bubkoo/html-to-image

    It needs to be installed using npm so I was wandering, how would I go about including this package dependency in my extension?

    The README for ext-template shows how to include a composer package but not an npm package ? Thank you in advance.

  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi,

    There's no functionality for this in ext-template. Consider writing some additional build script that will copy the needed build file from the node_modules to src/client/modules/{your-module}/lib. Or even consider using some bundler to build a UMD for Espo if there's no build shipped with the lib.

    As installing extensions in Espo does not require users to run build in CLI, the trade off it that the extensions should be shipped with pre-bundled 3rd party libs.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    Working...