nuxt.config.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. const path = require('path')
  2. const isProdMode = Object.is(process.env.NODE_ENV, 'production')
  3. const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://10.10.100.107:8081/platform-b2c/' : 'http://192.168.253.60:9090/platform-b2c/')
  4. module.exports = {
  5. router: {
  6. middleware: 'check-auth'
  7. },
  8. /*
  9. ** Headers of the page
  10. */
  11. head: {
  12. meta: [
  13. { charset: 'utf-8' },
  14. { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' },
  15. { name: 'render', content: 'webkit' },
  16. { name: 'viewport', content: 'width=device-width, initial-scale=1' }
  17. ],
  18. link: [
  19. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
  20. ]
  21. },
  22. /*
  23. ** Customize the progress-bar color
  24. */
  25. loading: { color: '#3B8070' },
  26. /*
  27. ** Build configuration
  28. */
  29. build: {
  30. /*
  31. ** Run ESLINT on save
  32. */
  33. extend (config, { dev, isClient, isServer }) {
  34. config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  35. config.module.rules.push({
  36. test: /\.scss$/,
  37. loader: 'vue-style-loader!css-loader!sass-loader'
  38. })
  39. config.module.rules.push({
  40. test: /\.js$/,
  41. loader: 'babel-loader'
  42. })
  43. if (isClient) {
  44. config.module.rules.push({
  45. enforce: 'pre',
  46. test: /\.(js|vue)$/,
  47. loader: 'eslint-loader',
  48. exclude: /(node_modules)/
  49. })
  50. }
  51. },
  52. vendor: [
  53. 'axios',
  54. 'swiper',
  55. 'element-ui'
  56. ],
  57. babel: {
  58. presets: ['es2015', 'stage-2'],
  59. plugins: [
  60. 'transform-async-to-generator',
  61. 'transform-runtime'
  62. ],
  63. comments: true
  64. },
  65. postcss: [
  66. require('autoprefixer')({
  67. browsers: ['last 3 versions']
  68. })
  69. ]
  70. },
  71. css: [
  72. /* {
  73. src: 'font-awesome/css/font-awesome.css'
  74. }, */{src: '~assets/scss/app.scss', lang: 'scss'}
  75. /* {
  76. src: 'swiper/dist/css/swiper.css'
  77. } */ /* , {
  78. src: 'element-ui/lib/theme-default/index.css'
  79. } */
  80. ],
  81. dev: !isProdMode,
  82. env: {
  83. baseUrl
  84. },
  85. plugins: [{
  86. src: '~plugins/axios.js'
  87. }, {
  88. src: '~plugins/swiper.js',
  89. ssr: false
  90. }, {
  91. src: '~plugins/vue-loading.js',
  92. ssr: false
  93. }, {
  94. src: '~plugins/vue-empty.js',
  95. ssr: false
  96. }, {
  97. src: '~plugins/element-ui.js',
  98. ssr: false
  99. }, {
  100. src: '~plugins/filters.js',
  101. ssr: false
  102. }, {
  103. src: '~plugins/jsonp.js',
  104. ssr: false
  105. }],
  106. /* TODO 暂时代理到商城测试版,之后再做出调整 */
  107. proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**', '/file**', '/rate/**', '/log/**', '/help-service/**', '/keyword/**']
  108. }