nuxt.config.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. const isProdMode = Object.is(process.env.NODE_ENV, 'production')
  2. const baseUrl = process.env.BASE_URL || process.env.npm_package_config_nuxt_baseUrl
  3. module.exports = {
  4. /*
  5. ** Headers of the page
  6. */
  7. head: {
  8. title: '应用市场',
  9. meta: [
  10. { charset: 'utf-8' },
  11. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  12. { hid: 'description', name: 'description', content: 'Nuxt.js project' }
  13. ],
  14. link: [
  15. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
  16. { rel: 'stylesheet', href: '//at.alicdn.com/t/font_600318_am51f7e1qhncdi.css'}
  17. ]
  18. },
  19. /*
  20. ** Customize the progress bar color
  21. */
  22. loading: { color: '#3B8070' },
  23. /*
  24. ** Build configuration
  25. */
  26. build: {
  27. /*
  28. ** Run ESLint on save
  29. */
  30. extend (config, { isDev, isClient }) {
  31. if (isDev && isClient) {
  32. config.module.rules.push({
  33. enforce: 'pre',
  34. test: /\.(js|vue)$/,
  35. loader: 'eslint-loader',
  36. exclude: /(node_modules)/
  37. })
  38. }
  39. },
  40. vendor: [
  41. 'axios',
  42. 'element-ui'
  43. ],
  44. babel: {
  45. presets: [
  46. ["env", {
  47. targets: {
  48. 'node': 'current'
  49. },
  50. useBuiltIns: true,
  51. // debug: !isProdMode,
  52. include: [
  53. 'transform-async-to-generator'
  54. ]
  55. }]
  56. ],
  57. plugins: [
  58. ['transform-object-rest-spread', { useBuiltIns: true }],
  59. ['syntax-dynamic-import'],
  60. ['transform-runtime']
  61. ]
  62. }
  63. },
  64. css: [
  65. 'font-awesome/css/font-awesome.css',
  66. 'element-ui/lib/theme-chalk/index.css',
  67. '@/assets/css/common.css'
  68. ],
  69. dev: !isProdMode,
  70. env: {
  71. baseUrl
  72. },
  73. plugins: [
  74. '@/plugins/element-ui',
  75. '@/plugins/axios'
  76. ],
  77. serverMiddleware: [
  78. '@/server/proxy'
  79. ],
  80. proxyTable: [
  81. "/api/**"
  82. ]
  83. }