nuxt.config.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import Components from 'unplugin-vue-components/vite'
  2. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
  3. import AutoImport from 'unplugin-auto-import/vite'
  4. import path from 'path'
  5. // import {useStoreI18n} from './utils/i18n.js'
  6. // const { $$t } = useStoreI18n()
  7. // https://nuxt.com/docs/api/configuration/nuxt-config
  8. export default defineNuxtConfig({
  9. compatibilityDate: '2024-11-01',
  10. devtools: { enabled: true },
  11. modules: [
  12. '@nuxtjs/i18n',
  13. '@element-plus/nuxt'
  14. ],
  15. alias: {
  16. // 将 `@css` 映射到 `public/css` 文件夹
  17. '@': 'assets',
  18. '~': `${path.resolve(__dirname, 'styles')}/`,
  19. },
  20. i18n: {
  21. locales: ["en","zh"],
  22. defaultLocale: 'zh',
  23. strategy: 'no_prefix',
  24. vueI18n: './i18n.config.ts',
  25. },
  26. runtimeConfig: {
  27. public: {
  28. baseApi: process.env.VITE_APP_BASE_URL,
  29. }
  30. },
  31. app: {
  32. head: {
  33. title: '开心中文',
  34. meta: [
  35. {
  36. name: 'charset',
  37. content: 'utf-8'
  38. },
  39. {
  40. name: 'viewport',
  41. content: 'width=device-width,width=1250,maximum-scale=1.0'
  42. },
  43. {
  44. name: 'renderer',
  45. content: 'webkit'
  46. }
  47. ],
  48. link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
  49. }
  50. },
  51. devServer: {
  52. port:3002
  53. },
  54. vite: {
  55. css: {
  56. preprocessorOptions: {
  57. // 设置你的主题色
  58. scss: {
  59. additionalData: `@use "~/element/index.scss" as *; `
  60. }
  61. }
  62. },
  63. plugins: [
  64. Components({
  65. resolvers: [ElementPlusResolver()],
  66. }),
  67. AutoImport({
  68. resolvers: [ElementPlusResolver()],
  69. }),
  70. ],
  71. },
  72. // css: [
  73. // '@/css/swiper-bundle.min.css', // 引入 FontAwesome 样式
  74. // ],
  75. // build: {
  76. // transpile: ['@fortawesome/fontawesome-free'], // 确保 FontAwesome 样式和字体文件能够被编译
  77. // }
  78. })