vue.config.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. const path = require('path')
  2. const poststylus = require('poststylus')
  3. const pxtorem = require('postcss-pxtorem')
  4. const resolve = file => path.resolve(__dirname, file)
  5. const port = process.env.port || process.env.npm_config_port || 9527 // dev port
  6. const name = "应用中心"
  7. module.exports = {
  8. publicPath: './', // 本地
  9. outputDir: 'dist',
  10. assetsDir: 'static',
  11. lintOnSave: process.env.NODE_ENV === 'development',
  12. productionSourceMap: false,
  13. configureWebpack: {
  14. // provide the app's title in webpack's name field, so that
  15. // it can be accessed in index.html to inject the correct title.
  16. name: name,
  17. resolve: {
  18. alias: {
  19. '@': resolve('src')
  20. }
  21. }
  22. },
  23. devServer: {
  24. port: port,
  25. open: true,
  26. overlay: {
  27. warnings: false,
  28. errors: true
  29. },
  30. proxy: {
  31. [process.env.VUE_APP_BASE_API]: {
  32. target: process.env.VUE_APP_BASE_API,
  33. changeOrigin: true,
  34. pathRewrite: {
  35. ['^' + process.env.VUE_APP_BASE_API]: ''
  36. }
  37. }
  38. },
  39. // after: require('./mock/mock-server.js')
  40. },
  41. css: {
  42. loaderOptions: {
  43. sass: {
  44. // data: `@import "@/style/index.scss";`
  45. },
  46. stylus: {
  47. use: [
  48. poststylus([
  49. pxtorem({
  50. rootValue: 100,
  51. propWhiteList: [],
  52. minPixelValue: 2
  53. }),
  54. 'autoprefixer'
  55. ])
  56. ],
  57. import: [
  58. resolve('./src/assets/theme.custom')
  59. ]
  60. },
  61. postcss: {
  62. plugins: [
  63. require('postcss-pxtorem')({
  64. rootValue: 100,
  65. propWhiteList: [],
  66. minPixelValue: 2
  67. }),
  68. require('autoprefixer')()
  69. ]
  70. }
  71. }
  72. },
  73. transpileDependencies: [
  74. 'mand-mobile'
  75. ]
  76. }