vite.config.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import uni from "@dcloudio/vite-plugin-uni";
  2. import AutoImport from 'unplugin-auto-import/vite'
  3. import {resolve} from 'path'
  4. import { defineConfig } from "vite";
  5. export default defineConfig({
  6. plugins: [
  7. uni(),
  8. AutoImport({
  9. include: [
  10. /.[tj]sx?$/, // .ts, .tsx, .js, .jsx
  11. /.vue$/,
  12. /.vue?vue/, // .vue
  13. ],
  14. dts: 'src/auto-imports.d.ts', // 安装好依赖后,重新运行编译即可自动在根目录下生成此声明文件
  15. imports: ['vue', 'uni-app', 'pinia'],
  16. eslintrc: {
  17. enabled: true, // Default `false`
  18. filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
  19. globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
  20. }
  21. }),
  22. ],
  23. resolve: {
  24. alias: {
  25. '@': resolve(__dirname, 'src'),
  26. '@stores': resolve(__dirname, 'src/stores'),
  27. '@img': resolve(__dirname, 'src/static/images'),
  28. },
  29. },
  30. build: {
  31. rollupOptions: {
  32. external: ['@dcloudio/uni-components/src/helpers/html-parser']
  33. }
  34. }
  35. })