Reputation: 41
I am trying to override the dependencies for one of the packages I am including in a polymer component, and can't seem to get it to work.
bower.json file looks like this:
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0",
"paper-material": "PolymerElements/paper-material#^1.0.0",
"paper-toolbar" : "PolymerElements/paper-toolbar#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
"iron-icon": "polymerelements/iron-icon#^1.0.0",
"iron-icons": "polymerelements/iron-icons#^1.0.0"
},
"overrides": {
"paper-styles": {
"dependencies": {
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"font-roboto": "PolymerElements/font-roboto-local#^1.0.1",
"polymer": "Polymer/polymer#^1.0.0"
}
}
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"web-component-tester": "*"
}
basically I am trying to replace the font-roboto package with the font-roboto-local package. Can anyone see what I am doing wrong here? Unless I am interpreting the documentation incorrectly, this should work.
Upvotes: 4
Views: 4481
Reputation: 828
Bower uses a flat dependency tree; so you don't need to change the dependencies of paper-styles via overrides
, you can do it directly in your bower.json
:
"dependencies": {
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
"font-roboto": "PolymerElements/font-roboto-local#^1.0.0"
}
Edit: At first this worked for me, but then bower suddenly switch back to using font-roboto
. This seems to be because paper-styles
requires ^1.0.1, but font-roboto-local
is only available in 1.0.0. This means that for bower satisfying the version is more important than which package to install.
I could fix this by setting the version to 1.0.0 without ^:
"dependencies": {
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
"font-roboto": "PolymerElements/font-roboto-local#1.0.0"
},
"resolutions": {
"font-roboto": "1.0.0"
}
The disadvantage is that you manually have to update the version now, but at least it works.
Upvotes: 3