[英]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.