nuxt.config.ts.bak 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. // https://nuxt.com/docs/api/configuration/nuxt-config
  5. export default defineNuxtConfig({
  6. ssr: false,
  7. router: {
  8. middleware: 'ssr' // 为所有页面添加SSR中间件
  9. },
  10. app: {
  11. head: {
  12. title: '问可汇',//网站地址栏位置的标题
  13. meta: [
  14. { charset: 'utf-8' },
  15. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  16. { name: 'format-detection', content: 'telephone=yes' },//添加移动端调用手机拨号功能
  17. // { hid: 'description', name: 'description', content: 'My awesome app' }
  18. ],
  19. // link: [{ rel: 'icon', type: 'image/x-icon', href: '/logo.jpg' }],//地址栏网站icon,可以自定义修改
  20. script: [
  21. { type: 'text/javascript', src: "https://webapi.amap.com/maps?v=2.0&key=4784a307149172798267bd43856ba7b9" },
  22. ]
  23. },
  24. },
  25. runtimeConfig: {
  26. // apiSecret 只能在服务器端上访问
  27. // apiSecret: '123',
  28. // public 命名空间中定义的,在服务器端和客户端都可以普遍访问
  29. public: {
  30. apiBase: process.env.NUXT_PUBLIC_API_BASE
  31. }
  32. },
  33. devtools: { enabled: true },
  34. devServer: {
  35. host: "0.0.0.0"
  36. },
  37. plugins: [
  38. { src: './public/myWow.js', mode: 'client' },
  39. ],
  40. css: [
  41. '@/assets/css/root.scss',
  42. // 直接加载一个 Node.js 模块。(在这里它是一个 Sass 文件)
  43. // 'bulma',
  44. // 项目里要使用的 SCSS 文件
  45. '@/assets/css/common.scss',
  46. 'animate.css',
  47. 'github-markdown-css/github-markdown.css'
  48. ],
  49. modules: ["nuxtjs-naive-ui"],
  50. vite: {
  51. plugins: [
  52. AutoImport({
  53. imports: [
  54. {
  55. 'naive-ui': [
  56. 'NCarousel',
  57. ]
  58. }
  59. ]
  60. }),
  61. Components({
  62. resolvers: [NaiveUiResolver()]
  63. })
  64. ]
  65. },
  66. build: {
  67. transpile:
  68. process.env.NODE_ENV === 'production'
  69. ? [
  70. 'naive-ui',
  71. 'vueuc',
  72. '@css-render/vue3-ssr',
  73. '@juggle/resize-observer'
  74. ]
  75. : ['@juggle/resize-observer']
  76. },
  77. compatibilityDate: '2024-07-08'
  78. })