nuxt.config.prod.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. const webpack = require('webpack')
  2. module.exports = {
  3. srcDir: 'src/',
  4. // rootDir: './',
  5. /*
  6. ** Router config
  7. */
  8. router: {
  9. middleware: [
  10. 'check-auth'
  11. ]
  12. },
  13. /*
  14. ** Headers of the page
  15. */
  16. head: {
  17. title: '市场管理信息系统',
  18. meta: [{
  19. charset: 'utf-8'
  20. },
  21. {
  22. name: 'viewport',
  23. content: 'width=device-width, initial-scale=1'
  24. },
  25. {
  26. hid: 'description',
  27. name: 'description',
  28. content: '市场管理信息系统'
  29. }
  30. ],
  31. link: [{
  32. rel: 'icon',
  33. type: 'image/x-icon',
  34. href: '/favicon.ico'
  35. }],
  36. script: [{
  37. src: '/js/utils.js'
  38. },
  39. {
  40. src: '/js/printUtilities.js'
  41. }
  42. ],
  43. },
  44. /*
  45. ** Customize the progress bar color
  46. */
  47. loading: {
  48. color: '#3B8070'
  49. },
  50. /*
  51. ** Build configuration
  52. */
  53. build: {
  54. babel: {
  55. plugins: ['transform-decorators-legacy', 'transform-class-properties']
  56. },
  57. extend(config, {
  58. isDev,
  59. isClient
  60. }) {
  61. config.resolve.alias['class-component'] = '@/plugins/class-component'
  62. },
  63. /*
  64. ** Run ESLint on save
  65. */
  66. // extend (config, ctx) {
  67. // if (ctx.dev && ctx.isClient) {
  68. // config.module.rules.push({
  69. // enforce: 'pre',
  70. // test: /\.(js|vue)$/,
  71. // loader: 'eslint-loader',
  72. // exclude: /(node_modules)/
  73. // })
  74. // }
  75. // },
  76. vendor: [
  77. // 'axios',
  78. 'element-ui',
  79. 'negotiator',
  80. 'vue-class-component',
  81. 'vuex-class',
  82. 'vue-i18n',
  83. 'vue-chartjs',
  84. 'vue-clipboards',
  85. 'moment',
  86. 'chart.js',
  87. 'deepmerge' // vue-chartjs dep
  88. ],
  89. extractCSS: true,
  90. filenames: {
  91. vendor: 'vendor.[hash:12].js',
  92. app: 'shanlan.[chunkhash:12].js',
  93. css: 'shanlan.[contenthash:12].css'
  94. },
  95. plugins: [
  96. new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /zh|en/)
  97. ]
  98. },
  99. /*
  100. ** Global CSS
  101. */
  102. css: [
  103. // 'normalize.css/normalize.css',
  104. 'element-ui/lib/theme-chalk/index.css',
  105. {
  106. src: '~assets/styles/main.scss',
  107. lang: 'scss'
  108. }
  109. // {src: '~assets/mstyles/index.scss', lang: 'scss'}
  110. ],
  111. /*
  112. ** Add element-ui in our app, see plugins/element-ui.js file
  113. */
  114. plugins: [
  115. '@/plugins/i18n',
  116. '@/plugins/element-ui',
  117. // '@/plugins/axios-defaults',
  118. {
  119. src: '@/plugins/clipboard',
  120. ssr: false
  121. },
  122. {
  123. src: '@/plugins/error-handler',
  124. ssr: false
  125. },
  126. {
  127. src: '@/plugins/vue-print-nb',
  128. ssr: false
  129. }
  130. ],
  131. modules: [
  132. // '@nuxtjs/auth',
  133. '~/modules/auth',
  134. '@nuxtjs/axios',
  135. ],
  136. auth: {
  137. user: {
  138. endpoint: 'users/me',
  139. propertyName: '',
  140. resetOnFail: true
  141. },
  142. login: {
  143. endpoint: 'auth'
  144. },
  145. logout: {
  146. endpoint: 'auth/logout',
  147. method: 'GET'
  148. },
  149. redirect: {
  150. notLoggedIn: '/login',
  151. loggedIn: '/'
  152. },
  153. token: {
  154. enabled: true,
  155. type: 'Bearer',
  156. localStorage: true,
  157. name: 'token',
  158. cookie: true,
  159. cookieName: 'token'
  160. }
  161. },
  162. axios: {
  163. /* --------Nuxt Start发版用 START-------------- */
  164. baseURL: '/api/'
  165. /* --------Nuxt Start发版用 END-------------- */
  166. },
  167. /*
  168. ** 客户端和服务端共享的环境变量,
  169. ** 客户端使用:process.env.appclient 服务端使用:context.appclient
  170. */
  171. env: {
  172. /* --------Nuxt Start发版用 START-------------- */
  173. appclient: 'gfgl', //供方信息管理平台
  174. upfilehost: '/uploadfile', //附件上传
  175. baseURL: '/api/', //本地工作流图片
  176. LOCAL_IP: '10.76.248.23' //定义服务器内网IP,word转PDF时用到
  177. // API_URL: 'http://10.76.248.23:10091/api/' //服务器渲染时调用
  178. /* --------Nuxt Start发版用 END-------------- */
  179. },
  180. }