2
3

nuxt.config.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. // {
  37. // rel: 'stylesheet',
  38. // href: '/src/assets/styles/common.css',
  39. // }
  40. ],
  41. script: [{
  42. src: '/js/utils.js'
  43. },
  44. {
  45. src: '/js/printUtilities.js'
  46. }
  47. ],
  48. },
  49. /*
  50. ** Customize the progress bar color
  51. */
  52. loading: {
  53. color: '#3B8070'
  54. },
  55. /*
  56. ** Build configuration
  57. */
  58. build: {
  59. babel: {
  60. plugins: ['transform-decorators-legacy', 'transform-class-properties']
  61. },
  62. extend(config, {
  63. isDev,
  64. isClient
  65. }) {
  66. config.resolve.alias['class-component'] = '@/plugins/class-component'
  67. },
  68. /*
  69. ** Run ESLint on save
  70. */
  71. // extend (config, ctx) {
  72. // if (ctx.dev && ctx.isClient) {
  73. // config.module.rules.push({
  74. // enforce: 'pre',
  75. // test: /\.(js|vue)$/,
  76. // loader: 'eslint-loader',
  77. // exclude: /(node_modules)/
  78. // })
  79. // }
  80. // },
  81. vendor: [
  82. // 'axios',
  83. 'element-ui',
  84. 'negotiator',
  85. 'vue-class-component',
  86. 'vuex-class',
  87. 'vue-i18n',
  88. 'vue-chartjs',
  89. 'vue-clipboards',
  90. 'moment',
  91. 'chart.js',
  92. 'deepmerge' // vue-chartjs dep
  93. ],
  94. extractCSS: true,
  95. filenames: {
  96. vendor: 'vendor.[hash:12].js',
  97. app: 'shanlan.[chunkhash:12].js',
  98. css: 'shanlan.[contenthash:12].css'
  99. },
  100. plugins: [
  101. new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /zh|en/)
  102. ]
  103. },
  104. /*
  105. ** Global CSS
  106. */
  107. css: [
  108. // 'normalize.css/normalize.css',
  109. 'element-ui/lib/theme-chalk/index.css',
  110. '~assets/styles/common.css',
  111. {
  112. src: '~assets/styles/main.scss',
  113. lang: 'scss'
  114. }
  115. // {src: '~assets/mstyles/index.scss', lang: 'scss'}
  116. ],
  117. /*
  118. ** Add element-ui in our app, see plugins/element-ui.js file
  119. */
  120. plugins: [
  121. '@/plugins/i18n',
  122. '@/plugins/element-ui',
  123. '@/plugins/mycomponents',
  124. // '@/plugins/axios-defaults',
  125. {
  126. src: '@/plugins/clipboard',
  127. ssr: false
  128. },
  129. {
  130. src: '@/plugins/error-handler',
  131. ssr: false
  132. },
  133. {
  134. src: '@/plugins/vue-print-nb',
  135. ssr: false
  136. }
  137. ],
  138. modules: [
  139. // '@nuxtjs/auth',
  140. '~/modules/auth',
  141. '@nuxtjs/axios',
  142. ],
  143. auth: {
  144. user: {
  145. endpoint: 'users/me',
  146. propertyName: '',
  147. resetOnFail: true
  148. },
  149. login: {
  150. endpoint: 'auth'
  151. },
  152. logout: {
  153. endpoint: 'auth/logout',
  154. method: 'GET'
  155. },
  156. redirect: {
  157. notLoggedIn: '/login',
  158. loggedIn: '/'
  159. },
  160. token: {
  161. enabled: true,
  162. type: 'Bearer',
  163. localStorage: true,
  164. name: 'token',
  165. cookie: true,
  166. cookieName: 'token'
  167. }
  168. },
  169. axios: {
  170. // baseURL: '//192.168.1.44:10091/api/' // 本机开发使用
  171. baseURL: '//localhost:10091/api/' // 本机开发使用
  172. // baseURL: '//192.168.1.41:10091/api/' // 本机开发使用
  173. // baseURL: '//192.168.124.10:10091/api/' // 本机开发使用
  174. /* --------Nuxt Start发版用 START-------------- */
  175. // baseURL: '/api/'
  176. /* --------Nuxt Start发版用 END-------------- */
  177. },
  178. /*
  179. ** 客户端和服务端共享的环境变量,
  180. ** 客户端使用:process.env.appclient 服务端使用:context.appclien
  181. */
  182. env: {
  183. appclient: 'gfgl', //供方管理系统
  184. imgserverhost: 'http://52.80.133.197:9081', //BioBank服务地址,图片上传文件
  185. upfilehost: 'http://weed1.labsop.cn:9333/dir/assign', //附件上传
  186. baseURL: '//localhost:10091/api/' //工作流图片
  187. /* --------Nuxt Start发版用 START-------------- */
  188. //
  189. // appclient: 'gfgl', //供方信息管理平台
  190. // upfilehost: '/uploadfile', //附件上传
  191. // baseURL: '/api/', //本地工作流图片
  192. // LOCAL_IP: '10.76.248.23' //定义服务器内网IP,word转PDF时用到
  193. // // API_URL: 'http://10.76.248.23:10091/api/' //服务器渲染时调用
  194. /* --------Nuxt Start发版用 END-------------- */
  195. },
  196. }