vue3.0 vue.config.js

module.exports = {
  publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
  outputDir: "dist",
  assetsDir: "static",
  indexPath: 'index.html',
  devServer: {
    overlay: {
      warnings: true,
      errors: true
    },
    // assetsDir: './',//静态资源目录(js,css,img,fonts)这些文件都可以写里面

    // 设置主机地址
    host: 'localhost',
    // 设置默认端口
    port: 8080,
    // 设置代理
    proxy: {
      '/api': {
        // 目标 API 地址
        target: 'http://192.168.124.231:8707/', // 接口的域名
        // 如果要代理 websockets
        ws: false,
        // 将主机标头的原点更改为目标URL
        changeOrigin: true
      }
    }
  }
}

文档https://cli.vuejs.org/zh/config/#assetsdir

猜你喜欢

转载自www.cnblogs.com/Quxiya/p/11613575.html