Wiredep正在改变index.html中的bower依赖关系。
它将bower_components/modernizr/modernizr.js更改为
../../../bower_components/modernizr/modernizr.js它为什么要这么做?如何改变它?
wiredep: {
app: {
src: ['src/main/webapp/index.html'],
exclude: [/angular-i18n/, /swagger-ui/]
},
test: {
src: 'src/test/javascript/karma.conf.js',
exclude: [/angular-i18n/, /swagger-ui/, /angular-scenario/],
ignorePath: /\.\.\/\.\.\//, // remove ../../ from paths of injected javascripts
devDependencies: true,
fileTypes: {
js: {
block: /(([\s\t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
}
}
}发布于 2017-08-03 01:19:28
如果您的index.html文件嵌套在另一个文件夹中,Wiredep会添加‘../’。
例如,我的index.html在我的模板/src/index.html中
您的bower_components应该在您的根文件中,所以如果您的设置类似于上面的设置,wiredep将正确地链接这些文件。如果没有,你需要在运行wiredep时告诉wiredep你的index.html路径在哪里。
同样,我的示例运行wiredep --src template/src/assets/index.html
使用wiredep CLI,如果您只使用命令行进行链接,而不是吞噬,这将更容易完成。
查看你的src位置,如果你的bower_components在你工作目录的根目录中,那么wiredep就是正确链接文件的地方。
https://stackoverflow.com/questions/41891257
复制相似问题