Vue 允许通过域名访问

本文展示了Vue CLI项目中vue.config.js的配置,通过设置devServer的allowedHosts为'all'、host为'0.0.0.0',以及port为9652,并启用historyApiFallback,从而实现通过任意域名或IP地址访问开发服务器。

作者:zhuge··预计阅读 1 分钟·812 阅读·0 评论
Vue 允许通过域名访问
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer:{
      historyApiFallback: true,
      allowedHosts: "all",
      port: 9652,
      host:'0.0.0.0'
  }
})

相关文章

评论

加载中...