Multiple versions of same JS library with Bower and django-pipeline

半城伤御伤魂 提交于 2019-12-12 19:29:53

问题


Two of the libraries I use in my single page application are moment and backgrid-moment-cell. I use bower to manage my front-end libraries and django-pipeline for asset packaging.

I'd like to use version 2.8.1 of moment, but backgrid-moment-cell requires version ~2.5.0. How can I get both version into my project?


回答1:


Front-end development should use a single dependency because you want to minimize the amount of code your users need to download. Bower helps you to manage this, which is a major benefit of using it. You have a few options:

  • Manually namespace the modules then include both (really not recommended)
  • Use resolutions in bower.json, but you may introduce bugs:
"resolutions": {
    "moment": "2.8.1"
}
  • Ask the maintainer to bump bower dependency versions (recommended)


来源:https://stackoverflow.com/questions/25132235/multiple-versions-of-same-js-library-with-bower-and-django-pipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!