vue.config.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. module.exports = {
  2. lintOnSave: false,
  3. devServer: {
  4. host:'0.0.0.0',
  5. port:8000, // 服务端口
  6. // port:8080,
  7. open: true,//配置自动启动浏览器
  8. proxy: { // 设置代理
  9. '/metroapi': {
  10. target: 'http://192.168.20.58:8086',//
  11. changeOrigin: true, //允许跨域
  12. pathRewrite: {
  13. '^/metroapi': ''
  14. }
  15. },
  16. // '/apis': {
  17. // target: 'http://192.168.20.54:7777',//
  18. // changeOrigin: true, //允许跨域 再设立一个可以跨不同的域
  19. // pathRewrite: {
  20. // '^/apis': ''
  21. // }
  22. // }
  23. },
  24. },
  25. publicPath: process.env.NODE_ENV === 'production' ? './' : '/', //部署后请求路径
  26. outputDir:'dist', // 打包的目录
  27. chainWebpack: config => {
  28. config.module
  29. .rule('stylus')
  30. .oneOf('vue')
  31. .use('px2rem-loader')
  32. .loader('px2rem-loader')
  33. .before('postcss-loader') // this makes it work.
  34. .options({
  35. remUnit: 192,
  36. remPrecision: 8
  37. }) // remUnit: 192代表以1920px为整体,如果设计稿的尺寸是750px,这里的值为75
  38. .end()
  39. }
  40. // chainWebpack: (config) => {
  41. // config.entry('main').add('babel-polyfill');
  42. // },
  43. // transpileDependencies: [
  44. // 'view-design' // 指定对第三方组件也进行babel-polyfill处理
  45. // ]
  46. };