nuxt.config.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // https://nuxt.com/docs/api/configuration/nuxt-config
  2. export default defineNuxtConfig({
  3. modules: ['@vueuse/nuxt', '@pinia/nuxt', '@nuxt/icon', '@nuxt/image', '@vant/nuxt'],
  4. compatibilityDate: '2025-07-15',
  5. // devtools: { enabled: true },
  6. css: ['~/assets/scss/main.scss'], // 全局样式文件
  7. plugins: ['~/plugins/index.js'],
  8. app: {
  9. head: {
  10. templateParams: {
  11. separator: '-'
  12. },
  13. titleTemplate: '%s %separator %siteName',
  14. meta: [
  15. { name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' },
  16. { name: 'description', content: '盾网络 - 专注于企业级DDoS/CC防护与安全加速的网络安全服务商。提供高防服务器、高防CDN、游戏盾SDK等全方位安全防护解决方案。' },
  17. { name: 'keywords', content: '高防服务器,DDoS防护,CC防护,高防CDN,游戏盾,网络安全,服务器加速' },
  18. { property: 'og:site_name', content: '盾网络' },
  19. { property: 'og:type', content: 'website' },
  20. { name: 'twitter:card', content: 'summary_large_image' }
  21. ],
  22. link: [
  23. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
  24. ]
  25. }
  26. },
  27. postcss: {
  28. plugins: {
  29. autoprefixer: {
  30. overrideBrowserslist: ['last 15 versions']
  31. },
  32. 'postcss-pxtorem': {
  33. rootValue: 37.5,
  34. unitPrecision: 4,
  35. propList: ['*'],
  36. selectorBlackList: [
  37. 'html',
  38. 'body',
  39. // 排除所有不以 mb- 开头的类选择器
  40. /^\.(?!mb-)/
  41. ],
  42. replace: true,
  43. mediaQuery: false,
  44. minRemValue: 0
  45. }
  46. }
  47. },
  48. icon: {
  49. localApiEndpoint: '/nuxt-icon'
  50. },
  51. image: {
  52. // format: ['avif', 'webp', 'png']
  53. format: ['webp', 'png']
  54. },
  55. nitro: {
  56. devProxy: {
  57. '/api': {
  58. target: 'http://localhost:8080', // 你的后端地址
  59. changeOrigin: true,
  60. prependPath: true
  61. }
  62. }
  63. },
  64. routeRules: {
  65. '/web/**': { appLayout: 'web' },
  66. '/mobile/**': { appLayout: 'mobile' }
  67. }
  68. // vite: {
  69. // css: {
  70. // preprocessorOptions: {
  71. // scss: {
  72. // additionalData: '@use "~/assets/_colors.scss" as *;'
  73. // }
  74. // }
  75. // }
  76. // }
  77. })