Bower在生产中加载devDependencies?

jch*_*ain 8 javascript angularjs leaflet bower

精简版

我的项目需要angular-leaflet,而angular-leaflet有很长的devDependencies列表,包括jQuery 2.我不想要jQuery 2 - 我想要jQuery 1.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"
  }
}
Run Code Online (Sandbox Code Playgroud)

运行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
Run Code Online (Sandbox Code Playgroud)

至少,我希望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
Run Code Online (Sandbox Code Playgroud)

为什么凉亭不会忽视角度传单的devDependencies?有没有办法让它这样做?

iX3*_*iX3 4

我认为您正在寻找的解决方案是虽然我不清楚为什么您的内容被分析resolutions的部分。bower.jsondevDependenciesdependencies

{
  "name": "bower-test",
  "dependencies": {
    "jquery": "1.x",
    "angular": "1.2.x",
    "angular-leaflet": "0.7.x"
  },
  "resolutions": {
    "jquery": "1.x"
  }
}
Run Code Online (Sandbox Code Playgroud)

也许这与除非指定或参数而npm执行bower install xyz包含略有不同,但即使指定了它似乎也没有被传递到——也许这是一个错误。devDependencies-p--productiondependencies

更新:问题似乎与使用这个特定的包/设置有关angular-leaflet。其他组件不存在此问题。例如, bower install webmaker-analytics仅获取webmaker-analyticsqunit即使它已列在此包的devDependencies.