nuxt.config.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. * 环境变量设置 新闻 拼路径时的根级别路径 多用于a标签 href属性
  61. */
  62. env: {
  63. baseUrl: 'http://localhost:3000'
  64. },
  65. /*
  66. ** Nuxt.js modules
  67. */
  68. modules: ['@nuxtjs/axios'],
  69. /*
  70. ** Build configuration
  71. ** See https://nuxtjs.org/api/configuration-build/
  72. */
  73. build: {
  74. transpile: [/^element-ui/],
  75. // 异步加载样式 默认false
  76. extractCSS: true
  77. },
  78. // server: {
  79. // port: 3000, // default: 3000
  80. // host: '192.168.0.79' // default: localhost,
  81. // },
  82. // server: {
  83. // port: 3000, // default: 3000
  84. // host: '192.168.0.179' // default: localhost,
  85. // },
  86. // server: {
  87. // port: 3000, // default: 3000
  88. // host: isDev ? dev.host : pro.host // default: localhost,
  89. // },
  90. axios: {
  91. // baseURL: isDev ? dev.baseURL : pro.baseURL
  92. // baseURL: 'http://182.92.186.22:83/api',
  93. baseURL: 'http://192.168.0.179:82/api',
  94. // baseURL: 'http://182.92.186.22:83/api', // Used as fallback if no runtime config is provided
  95. },
  96. };