vite.config.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import { defineConfig } from 'vite'
  2. import laravel from 'laravel-vite-plugin'
  3. import vue from '@vitejs/plugin-vue'
  4. import i18n from 'laravel-vue-i18n/vite'
  5. import AutoImport from 'unplugin-auto-import/vite'
  6. import version from './vite.version'
  7. const ASSET_URL = process.env.ASSET_URL || ''
  8. export default defineConfig({
  9. base: `${ASSET_URL}`,
  10. plugins: [
  11. laravel([
  12. 'resources/js/app.js',
  13. ]),
  14. vue({
  15. template: {
  16. transformAssetUrls: {
  17. // The Vue plugin will re-write asset URLs, when referenced
  18. // in Single File Components, to point to the Laravel web
  19. // server. Setting this to `null` allows the Laravel plugin
  20. // to instead re-write asset URLs to point to the Vite
  21. // server instead.
  22. base: null,
  23. // The Vue plugin will parse absolute URLs and treat them
  24. // as absolute paths to files on disk. Setting this to
  25. // `false` will leave absolute URLs un-touched so they can
  26. // reference assets in the public directory as expected.
  27. includeAbsolute: false,
  28. },
  29. },
  30. }),
  31. i18n('resources/lang'),
  32. AutoImport({
  33. // https://github.com/unplugin/unplugin-auto-import?tab=readme-ov-file#configuration
  34. // include: [
  35. // /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
  36. // /\.vue$/,
  37. // /\.vue\?vue/, // .vue
  38. // ],
  39. imports: [
  40. 'vue',
  41. 'vue-router',
  42. 'pinia',
  43. {
  44. '@vueuse/core': [
  45. 'useStorage',
  46. 'useClipboard',
  47. 'useNavigatorLanguage'
  48. ],
  49. 'laravel-vue-i18n': [
  50. 'i18nVue',
  51. 'trans',
  52. 'wTrans',
  53. 'getActiveLanguage',
  54. 'loadLanguageAsync',
  55. 'getActiveLanguage'
  56. ],
  57. '@kyvg/vue3-notification': [
  58. 'useNotification'
  59. ],
  60. },
  61. ],
  62. // resolvers: [
  63. // ElementPlusResolver(),
  64. // ],
  65. dirs: [
  66. './resources/js/components/**',
  67. './resources/js/composables/**',
  68. './resources/js/layouts/**',
  69. './resources/js/router/**',
  70. './resources/js/services/**',
  71. './resources/js/stores/**',
  72. ],
  73. vueTemplate: true,
  74. vueDirectives: true,
  75. dts: './auto-imports.d.ts',
  76. eslintrc: {
  77. enabled: true,
  78. filepath: './.eslintrc-auto-import.mjs',
  79. globalsPropValue: true, // 'readonly',
  80. },
  81. }),
  82. ],
  83. resolve: {
  84. alias: {
  85. '@': '/resources/js',
  86. },
  87. },
  88. build: {
  89. // sourcemap: true,
  90. rollupOptions: {
  91. output: {
  92. banner: '/*! 2FAuth version ' + version + ' - Copyright (c) 2025 Bubka - https://github.com/Bubka/2FAuth */',
  93. },
  94. },
  95. },
  96. // server: {
  97. // watch: {
  98. // followSymlinks: false,
  99. // }
  100. // }
  101. });