// vue.config.js
// 判斷如果不是線上環境就使用proxy代理請求
let proxyObj = {}
if (process.env.NODE_ENV !== 'production') {
proxyObj = {
'/api': {
target: `http://www.xxx.com`,
changeOrigin: true,
wx: true
}
}
}
module.exports = {
// 打包輸出路徑
outputDir: './mobile',
// 文件路徑如果js css
publicPath: './',
// eslint-loader 是否在保存的時候檢查
lintOnSave: true,
// 打包輸出靜態文件夾
assetsDir: 'static',
// 打包優化
productionSourceMap: false,
css: {
// 啓用 CSS modules
modules: false,
// 是否使用css分離插件
extract: true,
// 開啓 CSS source maps,一般不建議開啓
sourceMap: false,
loaderOptions: {
// postcss: { postcss-pxtorem rem 配置
// plugins: [
// require('postcss-pxtorem')({
// rootValue: 50, // 換算的基數
// propList: ['*']
// })
// ]
// },
// sass: { sass 全局css值變量
// data: `
// @import "@/assets/style/_variable.scss";
// @import "@/assets/style/my-mint.scss";
// `
// },
stylus: {
'resolve url': true,
import: []
}
}
},
devServer: {
// host: 'localhost',
// host: "0.0.0.0",
// port: 8080, // 端口號
https: false, // https:{type:Boolean}
open: true, // 配置自動啓動瀏覽器
hotOnly: true, // 熱更新
proxy: proxyObj
},
pluginOptions: {
'cube-ui': {
postCompile: true,
theme: false
}
}
}
個人vue.config.js配置
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.