[英]Bower Loading devDependencies in Production?
我的項目需要angular-leaflet,而angular-leaflet包含一長串devDependencies ,包括jQuery2 。我不需要jQuery 2--我需要jQuery1.x 。 如何讓Bower忽略angular-leaflet的devDependencies,讓我使用jQuery 1?
我正在使用涼亭1.2.8。 這是一個最小的bower.json,它為我重現了該問題:
{
"name": "bower-test",
"dependencies": {
"jquery": "1.x",
"angular": "1.2.x",
"angular-leaflet": "0.7.x"
}
}
運行bower install
導致以下錯誤:
Unable to find a suitable version for jquery, please choose one:
1) jquery#1.x which resolved to 1.11.0 and has bower-test as dependants
2) jquery#2.1.0 which resolved to 2.1.0 and has angular-leaflet#0.7.5 as dependants
3) jquery#>= 1.9.0 which resolved to 2.1.0 and has bootstrap#3.0.3 as dependants
至少,我希望bower install --production
可以忽略angular-leaflet中的devDependencies。 但是,這是結果(與上面相同):
Unable to find a suitable version for jquery, please choose one:
1) jquery#1.x which resolved to 1.11.0 and has bower-test as dependants
2) jquery#2.1.0 which resolved to 2.1.0 and has angular-leaflet#0.7.5 as dependants
3) jquery#>= 1.9.0 which resolved to 2.1.0 and has bootstrap#3.0.3 as dependants
為什么Bower不會忽略angular-leaflet的devDependencies? 有沒有辦法做到這一點?
我認為您正在尋找的解決方案是bower.json
的resolutions
部分,盡管對於為什么devDependencies
的dependencies
devDependencies
甚至被分析的原因我也不清楚。
{
"name": "bower-test",
"dependencies": {
"jquery": "1.x",
"angular": "1.2.x",
"angular-leaflet": "0.7.x"
},
"resolutions": {
"jquery": "1.x"
}
}
也許這與npm
稍有不同,除非指定了-p
或--production
參數,否則執行bower install xyz
包含devDependencies
,但是即使指定了它,它似乎也不會傳遞給dependencies
-也許這是一個錯誤。
更新:問題似乎與使用angular-leaflet
特定軟件包/設置有關。 其他組件沒有此問題。 例如, bower install webmaker-analytics
僅獲取webmaker-analytics
而不是qunit
即使它已在此軟件包的devDependencies
列出。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.