1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import path from "path";
- import { defineConfig, loadConfigFromFile, loadEnv, mergeConfig } from "vite";
- import vue from "@vitejs/plugin-vue2";
- import WindiCSS from "vite-plugin-windicss";
- import AutoImport from "unplugin-auto-import/vite";
- const config = defineConfig(async ({ command, mode, ssrBuild }) => {
- const subConfigModule = await loadConfigFromFile({ command, mode, ssrBuild }, path.join(process.cwd(), `./vite.config.${mode}.ts`))
- const baseConfig = {
- resolve: {
- alias: { "@pc": path.join(process.cwd(), './src/pc'), "@h5": path.join(process.cwd(), './src/h5') }
- },
- build: {
- minify: true,
- rollupOptions: {
- input: {
- pc: path.join(process.cwd(), './src/pc/index.html'),
- h5: path.join(__dirname, './src/h5/index.html')
- }
- }
- },
- plugins: [
- vue(),
- WindiCSS(),
- AutoImport({
- imports: ["@vueuse/core"],
- dts: "src/auto-imports.d.ts",
- }),
- ],
- server: {
- port: 3333,
- },
- }
- return mergeConfig(baseConfig, subConfigModule?.config as any, false)
- });
- export default config;
|