运行vue3,打开cpolar启动内网穿透,结果却发现
在vue.config.js中修改为如下代码:
const { defineConfig } = require('@vue/cli-service');
module.exports = defineConfig({
transpileDependencies: true,
devServer: {
allowedHosts: 'all',
host: '0.0.0.0',
port: 8080,
https: false, // 确保使用 HTTP
client: {
webSocketURL: {
protocol: 'ws',
hostname: 'localhost',
port: 8080
}
}
}
});
大功告成!