vue.config.js 907 B

1234567891011121314151617181920212223242526272829303132333435
  1. const { defineConfig } = require('@vue/cli-service')
  2. module.exports = defineConfig({
  3. transpileDependencies: true,
  4. devServer: {
  5. open: true, // 自动打开
  6. host: 'localhost',
  7. proxy: { // 配置代理
  8. '/api': {
  9. target: 'http://cc-api.localhost.cc/',
  10. changeOrigin: true, //允许跨域
  11. pathRewrite: {
  12. '^/api': 'api'
  13. }
  14. }
  15. }
  16. },
  17. css: {
  18. loaderOptions: {
  19. postcss: {
  20. postcssOptions: {
  21. plugins: [
  22. // 自动添加浏览器前缀
  23. require('autoprefixer'),
  24. // 单位转换插件
  25. require('postcss-pxtorem')({
  26. rootValue: 37.5, // 根据设计稿调整(设计稿宽度/10)
  27. propList: ['*'], // 转换所有属性
  28. exclude: /node_modules/ // 排除 node_modules 目录
  29. })
  30. ]
  31. }
  32. }
  33. }
  34. }
  35. })