nuxt.config.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. const dev = {
  2. baseURL: 'http://192.168.0.179:82/api',
  3. host: 'localhost',
  4. }
  5. const pro = {
  6. baseURL: 'http://182.92.186.22:83/api',
  7. host: 'http://182.92.186.22:83/api',
  8. }
  9. const isDev = true;
  10. export default {
  11. /*
  12. ** Nuxt rendering mode
  13. ** See https://nuxtjs.org/api/configuration-mode
  14. */
  15. mode: 'universal',
  16. /*
  17. ** Nuxt target
  18. ** See https://nuxtjs.org/api/configuration-target
  19. */
  20. target: 'server',
  21. /*
  22. ** Headers of the page
  23. ** See https://nuxtjs.org/api/configuration-head
  24. */
  25. head: {
  26. title: process.env.npm_package_name || '',
  27. meta: [
  28. { charset: 'utf-8' },
  29. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  30. { hid: 'description', name: 'description', content: process.env.npm_package_description || '' },
  31. ],
  32. link: [
  33. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
  34. ],
  35. },
  36. /*
  37. ** Global CSS
  38. */
  39. css: [
  40. 'element-ui/lib/theme-chalk/index.css',
  41. '@/assets/scss/main.scss'
  42. ],
  43. /*
  44. ** Plugins to load before mounting the App
  45. ** https://nuxtjs.org/guide/plugins
  46. */
  47. plugins: [
  48. '@/plugins/element-ui', '~/plugins/axios.http', {src:'~plugins/loadsh.js',ssr: false},
  49. ],
  50. /*
  51. ** Auto import components
  52. ** See https://nuxtjs.org/api/configuration-components
  53. */
  54. components: true,
  55. /*
  56. ** Nuxt.js dev-modules
  57. */
  58. buildModules: [],
  59. /*
  60. ** Nuxt.js modules
  61. */
  62. modules: ['@nuxtjs/axios'],
  63. /*
  64. ** Build configuration
  65. ** See https://nuxtjs.org/api/configuration-build/
  66. */
  67. build: {
  68. transpile: [/^element-ui/],
  69. // 异步加载样式 默认false
  70. extractCSS: true
  71. },
  72. // server: {
  73. // port: 3000, // default: 3000
  74. // host: '192.168.0.179' // default: localhost,
  75. // },
  76. // server: {
  77. // port: 3000, // default: 3000
  78. // host: isDev ? dev.host : pro.host // default: localhost,
  79. // },
  80. axios: {
  81. // baseURL: isDev ? dev.baseURL : pro.baseURL
  82. baseURL: 'http://192.168.0.179:82/api',
  83. // baseURL: 'http://182.92.186.22:83/api', // Used as fallback if no runtime config is provided
  84. },
  85. };