vue.config.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const path = require('path')
  2. const fs = require('fs')
  3. const resolve = dir => {
  4. return path.join(__dirname, dir)
  5. }
  6. const env = process.env.NODE_ENV || 'development'
  7. fs.writeFileSync(path.join(__dirname, './config/env.js'), `export default '${env}'
  8. `)
  9. // 项目部署基础
  10. // 默认情况下,我们假设你的应用将被部署在域的根目录下,
  11. // 例如:https://www.my-app.com/
  12. // 默认:'/'
  13. // 如果您的应用程序部署在子路径中,则需要在这指定子路径
  14. // 例如:https://www.foobar.com/my-app/
  15. // 需要将它改为'/my-app/'
  16. const BASE_URL = '/iview-admin/'
  17. module.exports = {
  18. // Project deployment base
  19. // By default we assume your app will be deployed at the root of a domain,
  20. // e.g. https://www.my-app.com/
  21. // If your app is deployed at a sub-path, you will need to specify that
  22. // sub-path here. For example, if your app is deployed at
  23. // https://www.foobar.com/my-app/
  24. // then change this to '/my-app/'
  25. baseUrl: BASE_URL,
  26. // tweak internal webpack configuration.
  27. // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  28. chainWebpack: config => {
  29. config.resolve.alias
  30. .set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
  31. .set('_c', resolve('src/components'))
  32. .set('_conf', resolve('config'))
  33. },
  34. // 打包时不生成.map文件
  35. productionSourceMap: false
  36. }