vite.config.js 857 B

1234567891011121314151617181920212223242526272829303132333435
  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. };