1.打包优化 --report npm run build --report 两个-
// 根目录创建vue.config.js
module.exports = {
configureWebpack: {
externals: {
vue: "Vue",
"vue-router": "VueRouter",
vant: "vant"
}
}
};
2.页面刷新404
// experss 操作 var history = require('connect-history-api-fallback'); app.use(history()); // nginx 配置 server { listen 8080; server_name itsse.cn; root /app; index index.php index.html index.htm; try_files $uri $uri/ /index.html; // 解决页面刷新404问题 } 或者 server { listen 8080; server_name itsse.cn; location / { root /app; index index.php index.html index.htm; try_files $uri $uri/ /index.html; // 解决页面刷新404问题 } }