vite.config.js 856 B

12345678910111213141516171819202122232425262728293031323334
  1. import { loadEnv } from 'vite';
  2. import uni from '@dcloudio/vite-plugin-uni';
  3. import path from 'path';
  4. // import viteCompression from 'vite-plugin-compression';
  5. import uniReadPagesV3Plugin from './sheep/router/utils/uni-read-pages-v3';
  6. import mpliveMainfestPlugin from './sheep/libs/mplive-manifest-plugin';
  7. // https://vitejs.dev/config/
  8. export default (command, mode) => {
  9. const env = loadEnv(mode, __dirname, 'SHOPRO_');
  10. return {
  11. envPrefix: "SHOPRO_",
  12. plugins: [
  13. uni(),
  14. // viteCompression({
  15. // verbose: false
  16. // }),
  17. uniReadPagesV3Plugin({
  18. pagesJsonDir: path.resolve(__dirname, './pages.json'),
  19. includes: ['path', 'aliasPath', 'name', 'meta'],
  20. }),
  21. mpliveMainfestPlugin(env.SHOPRO_MPLIVE_ON)
  22. ],
  23. server: {
  24. host: true,
  25. // open: true,
  26. port: env.SHOPRO_DEV_PORT,
  27. hmr: {
  28. overlay: true,
  29. },
  30. },
  31. };
  32. };