0

I've created my own plugin in OctoberCMS. Some of my plugin's features make use of JavaScript, which can be put in author/plugin/assets/js folder and added to a plugin component by using the addJs function as described in the docs. You can even combine your plugin's JS files like this.

That's all good, but my plugin is making use of some external JS libraries. I know I can install them with npm in my site theme, but then my plugin wouldn't work for anyone using a theme that didn't install those libraries.

So what I'm asking is: How can I include npm dependencies in my plugin?

Jones03
  • 1,207
  • 2
  • 12
  • 30
  • 1
    hmm why dont you just ship them with your plugin or any issue ? mostly publisher provides stand alone version you can download and use as single file and not as NPM package you can use it – Hardik Satasiya Feb 10 '20 at 11:18
  • Because you loose all the advantages NPM provides. Such as easily updating, making sure you don't have duplicate packages, etc. Manually including the vendor file feels a bit like going back to the old days. – Jones03 Feb 10 '20 at 14:10
  • hmm then make a bundle of your files and use that `bundle.js` as your js file and ship with that. so you can have best of both world :) – Hardik Satasiya Feb 10 '20 at 14:24

0 Answers0