vue.config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const ENV = process.env.NODE_ENV
  2. const BUILD_ENV = process.env.BUILD_ENV
  3. const path = require('path')
  4. const gameUrl = 'k3.eosget.io'
  5. function resolve (dir) {
  6. return path.join(__dirname, dir)
  7. }
  8. function getBaseUrl () {
  9. if (ENV === 'development') {
  10. return '/'
  11. } else if (BUILD_ENV === 'test') {
  12. return '/dist/'
  13. } else {
  14. let pre = BUILD_ENV === 'production' ? '' : `${BUILD_ENV}-`
  15. return `https://static.meechat.me/cdn/${pre}${gameUrl}/dist/`
  16. }
  17. };
  18. module.exports = {
  19. indexPath: ENV === 'production' ? '../protected/views/index.html' : 'index.html',
  20. outputDir: './dist', // build 时生成的生产环境构建文件的目录
  21. publicPath: getBaseUrl(),
  22. lintOnSave: true, // 关闭eslint
  23. productionSourceMap: false, // 生产环境取消source map
  24. pages: {
  25. index: {
  26. entry: '_src/main.js'
  27. }
  28. },
  29. chainWebpack: (config) => {
  30. config.resolve.alias
  31. .set('@', resolve('_src'))
  32. .set('!', resolve(''))
  33. },
  34. css: {
  35. loaderOptions: {
  36. sass: {
  37. data: `@import "@/style/mixins.scss";`
  38. }
  39. }
  40. }
  41. }