Rumah > Soal Jawab > teks badan
dev的时候没有问题,build之后出现问题
http://172.16.0.10:8085/backend/dist/static/css/static/fonts/glyphicons-halflings-regular.448c34a.woff2 Failed to load resource: the server responded with a status of 404 (Not Found) http://172.16.0.10:8085/backend/dist/static/css/static/fonts/glyphicons-halflings-regular.fa27723.woff Failed to load resource: the server responded with a status of 404 (Not Found) http://172.16.0.10:8085/backend/dist/static/css/static/fonts/glyphicons-halflings-regular.e18bbf6.ttf Failed to load resource: the server responded with a status of 404 (Not Found)
webpack关于这里的编译和路径没有改动:
{ test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url', query: { limit: 10000, name: utils.assetsPath('fonts/[name].[hash:7].[ext]') } }
ps:其它插件的fonticon没有此问题
2016年10月12日 12:58:31
找到问题所在了。
因为bootstrap等一些插件他们css中,引入font的路径为../font/.....
然而webpack的配置中:为:
{ test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url', query: { limit: 10000, name: utils.assetsPath('fonts/[name].[hash:7].[ext]') } }
所以只要加一个query对象:
{ test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url', query: [{ limit: 10000, name: utils.assetsPath('fonts/[name].[hash:7].[ext]') }, { limit: 10000, name: utils.assetsPath('../fonts/[name].[hash:7].[ext]') }] }
问题就解决了!
三叔2016-11-14 11:25:21
找到问题所在了。
因为bootstrap等一些插件他们css中,引入font的路径为../font/.....
然而webpack的配置中:为:
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url', query: { limit: 10000, name: utils.assetsPath('fonts/[name].[hash:7].[ext]') } }
所以只要加一个query对象:
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url', query: [{ limit: 10000, name: utils.assetsPath('fonts/[name].[hash:7].[ext]') }, { limit: 10000, name: utils.assetsPath('../fonts/[name].[hash:7].[ext]') }] }
问题就解决了!