uniapp+vue3使用unocss报错
vite.config.ts代码:
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from "unplugin-auto-import/vite";
import Unocss from 'unocss/vite';export default defineConfig({plugins: [uni(),Unocss(),AutoImport({imports: ["vue","uni-app","pinia",{"nutui-uniapp/composables": ["useToast"]}]})],
});
报错:Error [ERR_REQUIRE_ESM]: require() of ES Module D:\ not supported
at Object. (D:\项目\vite.config.ts:39:28)
原因:
版本问题,unocss版本为0.60,降至0.58,报错解决