vuecli3配置文件 vue.config.js


module.exports = {
  publicPath: "/", // 部署應⽤包時的基本 URL
  outputDir: "dist", // npm run build ⽣成的⽂件夾,默認是dist
  assetsDir: "static", // 在kaixin⽂件夾下⾯⽣成static⽬錄存放js,img,css等靜態資源
  indexPath: "index.html", // ⽣成的單⽂件的,⽂件名,
  devServer: {
    host: "127.0.0.1", // 配置主機地址
    port: process.env.NODE_ENV == 'production' ? 3000 : 8888, // 配置運⾏的端⼝
    
    // proxy: "接⼝地址",  跨域代理! 【重要!】
    proxy: { // 配置多個!
      '/api': {
        target: 'http://localhost:3030/api',
        ws: true, // 跨域地址是https協議!
        changeOrigin: true,
        pathWrite: {
          "^/api": ""   // 將 '/api' 替換成 ''  
        }
      }
    },
  }
  
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM