import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' import { NaiveUiResolver } from 'unplugin-vue-components/resolvers' // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ ssr: false, router: { middleware: 'ssr' // 为所有页面添加SSR中间件 }, app: { head: { title: '问可汇',//网站地址栏位置的标题 meta: [ { charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { name: 'format-detection', content: 'telephone=yes' },//添加移动端调用手机拨号功能 // { hid: 'description', name: 'description', content: 'My awesome app' } ], // link: [{ rel: 'icon', type: 'image/x-icon', href: '/logo.jpg' }],//地址栏网站icon,可以自定义修改 script: [ { type: 'text/javascript', src: "https://webapi.amap.com/maps?v=2.0&key=4784a307149172798267bd43856ba7b9" }, ] }, }, runtimeConfig: { // apiSecret 只能在服务器端上访问 // apiSecret: '123', // public 命名空间中定义的,在服务器端和客户端都可以普遍访问 public: { apiBase: process.env.NUXT_PUBLIC_API_BASE } }, devtools: { enabled: true }, devServer: { host: "0.0.0.0" }, plugins: [ { src: './public/myWow.js', mode: 'client' }, ], css: [ '@/assets/css/root.scss', // 直接加载一个 Node.js 模块。(在这里它是一个 Sass 文件) // 'bulma', // 项目里要使用的 SCSS 文件 '@/assets/css/common.scss', 'animate.css', 'github-markdown-css/github-markdown.css' ], modules: ["nuxtjs-naive-ui"], vite: { plugins: [ AutoImport({ imports: [ { 'naive-ui': [ 'NCarousel', ] } ] }), Components({ resolvers: [NaiveUiResolver()] }) ] }, build: { transpile: process.env.NODE_ENV === 'production' ? [ 'naive-ui', 'vueuc', '@css-render/vue3-ssr', '@juggle/resize-observer' ] : ['@juggle/resize-observer'] }, compatibilityDate: '2024-07-08' })