nuxt.config.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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/mycomponents',
  118. // '@/plugins/axios-defaults',
  119. {
  120. src: '@/plugins/clipboard',
  121. ssr: false
  122. },
  123. {
  124. src: '@/plugins/error-handler',
  125. ssr: false
  126. },
  127. {
  128. src: '@/plugins/vue-print-nb',
  129. ssr: false
  130. }
  131. ],
  132. modules: [
  133. // '@nuxtjs/auth',
  134. '~/modules/auth',
  135. '@nuxtjs/axios',
  136. ],
  137. auth: {
  138. user: {
  139. endpoint: 'users/me',
  140. propertyName: '',
  141. resetOnFail: true
  142. },
  143. login: {
  144. endpoint: 'auth'
  145. },
  146. logout: {
  147. endpoint: 'auth/logout',
  148. method: 'GET'
  149. },
  150. redirect: {
  151. notLoggedIn: '/login',
  152. loggedIn: '/'
  153. },
  154. token: {
  155. enabled: true,
  156. type: 'Bearer',
  157. localStorage: true,
  158. name: 'token',
  159. cookie: true,
  160. cookieName: 'token'
  161. }
  162. },
  163. axios: {
  164. baseURL: '//192.168.1.44:10091/api/' // 本机开发使用
  165. // baseURL: '//localhost:10091/api/' // 本机开发使用
  166. // baseURL: '//192.168.1.41:10091/api/' // 本机开发使用
  167. // baseURL: '//192.168.124.13:10091/api/' // 本机开发使用
  168. /* --------Nuxt Start发版用 START-------------- */
  169. // baseURL: '/api/'
  170. /* --------Nuxt Start发版用 END-------------- */
  171. },
  172. /*
  173. ** 客户端和服务端共享的环境变量,
  174. ** 客户端使用:process.env.appclient 服务端使用:context.appclient
  175. */
  176. env: {
  177. appclient: 'gfgl', //供方管理系统
  178. imgserverhost: 'http://52.80.133.197:9081', //BioBank服务地址,图片上传文件
  179. upfilehost: 'http://weed1.labsop.cn:9333/dir/assign', //附件上传
  180. baseURL: '//localhost:10091/api/' //工作流图片
  181. /* --------Nuxt Start发版用 START-------------- */
  182. //
  183. // appclient: 'gfgl', //供方信息管理平台
  184. // upfilehost: '/uploadfile', //附件上传
  185. // baseURL: '/api/', //本地工作流图片
  186. // LOCAL_IP: '10.76.248.23' //定义服务器内网IP,word转PDF时用到
  187. // // API_URL: 'http://10.76.248.23:10091/api/' //服务器渲染时调用
  188. /* --------Nuxt Start发版用 END-------------- */
  189. },
  190. }