ChunkLoadError: Loading chunk runHotelCheckin failed.
(missing: http://120.2.3.212:10082/infoManage/static/js/runHotelCheckin.dev.js?v=1704359862052)
后面查找原因是vue.config.js中的publicPath: './'的问题,把它改成publicPath: '/'然后打包就好了
<script src="./static/update.js"></script> 改成 <script src="/static/update.js"></script>
server {
listen 10082;
location / {
root html;
try_files $uri $uri/ /index.html;
}
}
//1.先安装依赖
npm install --save connect-history-api-fallback
//2.引入中间件
var history = require('connect-history-api-fallback');
//3.使用中间件(下面两种方式)history({})方法内部可配置参数,参考官方文档
//方式一(原生node):
var connect = require('connect');
var app = connect()
.use(history())
.listen(3000);
//方式二(express):
var express = require('express');
var app = express();
app.use(history());
参考vue官方文档