前端开发环境:
- react:^16.4.1
- webpack:^4.16.0
webpack添加favicon.ico配置:
const HtmlWebpackPlugin = require('html-webpack-plugin');
new HtmlWebpackPlugin({
template: 'index.html',
favicon: path.resolve('favicon.ico')
})
nginx添加对ico的支持:
location / {
root xxx;
index index.html index.htm;
rewrite ^/(.*)/(.*\.js$) /$1/$2 break;
rewrite ^/(.*)/(.*\.map$) /$1/$2 break;
rewrite ^/(.*)/(.*\.css$) /$1/$2 break;
rewrite ^/(.*)/(.*\.(png|jpg|gif|ico)$) /$1/$2 break;
rewrite ^/(.*)/(.*\.(ttf|woff|woff2|svg|otf|eot)$) /$1/$2 break;
rewrite ^/(.*)/ /$1/index.html break;
# try_files $uri $uri/ /index.html;
}