nuxt.config.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import AutoImport from 'unplugin-auto-import/vite'
  2. import Components from 'unplugin-vue-components/vite'
  3. import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
  4. import path from 'path'
  5. // https://nuxt.com/docs/api/configuration/nuxt-config
  6. export default defineNuxtConfig({
  7. ssr: true,
  8. app: {
  9. head: {
  10. title: '百谏方略',//网站地址栏位置的标题
  11. meta: [
  12. { charset: 'utf-8' },
  13. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  14. { name: 'format-detection', content: 'telephone=yes' },//添加移动端调用手机拨号功能
  15. { name: 'viewport', content: 'width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0' }
  16. ],
  17. link: [
  18. // { rel: "resource", type: "application/110n", href: "/_nuxt/viewer.properties" }
  19. ],
  20. // <script type="text/javascript" src="/static/js/wow.js"></script>
  21. script: [
  22. // { type: 'text/javascript', src: "https://webapi.amap.com/maps?v=2.0&key=4784a307149172798267bd43856ba7b9" },
  23. // { type: 'text/javascript', src: "wow.js" },
  24. ]
  25. },
  26. },
  27. nitro: {
  28. // 代理
  29. devProxy: {
  30. '/api': {
  31. target: 'https://www.driveintelresearch.com/api/js/a/api',
  32. // target: 'http://192.168.0.70:8980/js/a/api',
  33. // target: 'http://192.168.0.132//js/a/api',
  34. changeOrigin: true,
  35. prependPath: true,
  36. secure: false,
  37. },
  38. },
  39. },
  40. runtimeConfig: {
  41. // apiSecret 只能在服务器端上访问
  42. // apiSecret: '123',
  43. // public 命名空间中定义的,在服务器端和客户端都可以普遍访问
  44. public: {
  45. domainName: process.env.NUXT_PUBLIC_DOMAIN_NAME,
  46. apiBase: process.env.NUXT_PUBLIC_API_BASE,
  47. baseUrl: process.env.NUXT_PUBLIC_API_BASEURL
  48. }
  49. },
  50. devtools: { enabled: true },
  51. devServer: {
  52. host: "0.0.0.0"
  53. },
  54. plugins: [
  55. { src: './public/wow.js', mode: 'client' },
  56. // { src: './public/myWow.js', mode: 'client' },
  57. '~/plugins/pinia.js'
  58. ],
  59. css: [
  60. '@/assets/css/root.scss',
  61. // 直接加载一个 Node.js 模块。(在这里它是一个 Sass 文件)
  62. // 'bulma',
  63. // 项目里要使用的 SCSS 文件
  64. '@/assets/css/common.scss',
  65. // 'animate.css',
  66. // '@/assets/styles/animate.css',
  67. 'github-markdown-css/github-markdown.css'
  68. ],
  69. modules: ["nuxtjs-naive-ui", '@nuxtjs/i18n', '@pinia/nuxt'],
  70. i18n: {
  71. locales: ['en', 'zh'],
  72. defaultLocale: 'en',
  73. vueI18n: './lang/i18n.ts',
  74. customRoutes: 'config',
  75. // parsePages: false,
  76. strategy: 'prefix_except_default',
  77. detectBrowserLanguage: false, // 禁用浏览器检测
  78. pages: {
  79. // 'news/index': {
  80. // en: '/en/news-categories/:activeIndustryType?/:keyword?',
  81. // zh: '/news-categories/:activeIndustryType?/:keyword?'
  82. // },
  83. 'report-industries/detail': {
  84. zh: '/reports/[webTitle]',
  85. en: '/reports/[webTitle]'
  86. },
  87. 'news-categories/detail': {
  88. zh: '/news/[webTitle]',
  89. en: '/news/[webTitle]'
  90. },
  91. 'contact/index': {
  92. zh: '/contactUs',
  93. en: '/contactUs'
  94. }
  95. }
  96. },
  97. vite: {
  98. plugins: [
  99. AutoImport({
  100. imports: [
  101. {
  102. 'naive-ui': [
  103. 'NCarousel',
  104. ]
  105. }
  106. ]
  107. }),
  108. Components({
  109. resolvers: [NaiveUiResolver()]
  110. })
  111. ],
  112. },
  113. build: {
  114. transpile:
  115. process.env.NODE_ENV === 'production'
  116. ? [
  117. 'naive-ui',
  118. 'vueuc',
  119. '@css-render/vue3-ssr',
  120. '@juggle/resize-observer'
  121. ]
  122. : ['@juggle/resize-observer'],
  123. },
  124. compatibilityDate: '2025-02-20'
  125. })