I'm wondering is there a way to add third-party js libraries to Magento 2 via Composer?

The main idea of this is to separate our modules from those dependencies and to have them required via Composer instead of having them inside modules.

For example, I'm going to implement a Magento 2 module. I would like to use 3rd-party js library to have a user-friendly chart.

How should I use the library in my module?

For now, I see one way only:

  1. Add the library to files of the module

1 Answer 1


I guess you can make a private composer repo that you could add your libraries there. And update them when needed. Else you should use Grunt and node.

  • In which way should I require a JS library that is included like this? May 12, 2017 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.