vite.config.h5.ts 790 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { defineConfig, loadConfigFromFile, loadEnv } from "vite";
  2. import Components from "unplugin-vue-components/vite";
  3. var pxtoviewport = require("postcss-px-to-viewport");
  4. const config = defineConfig(({ command, mode, ssrBuild }) => {
  5. return {
  6. plugins: [
  7. Components({
  8. dirs: [
  9. "src/h5/components",
  10. "src/common/components",
  11. "src/h5/pages/**/_components",
  12. ],
  13. resolvers: [],
  14. dts: "src/h5/components.d.ts",
  15. }),
  16. ],
  17. server: {
  18. port: 3333,
  19. },
  20. css: {
  21. postcss: {
  22. plugins: [
  23. pxtoviewport({
  24. viewportWidth: 375,
  25. propList: ["*"],
  26. include: /\/node_modules\/vant/,
  27. }),
  28. ],
  29. },
  30. },
  31. };
  32. });
  33. export default config;