nuxt.config.js 4.8 KB

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