You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1007 B

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from 'unplugin-vue-components/resolvers';
import { resolve } from 'path';
import alias from '@rollup/plugin-alias';
import topLevelAwait from "vite-plugin-top-level-await";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const isProduction = mode === 'production';
const isSlashEnv = mode === 'slash';
const outDir = isSlashEnv ? '../build/m' : './dist';
return {
base: '/m/',
server: {
host: '0.0.0.0'
},
plugins: [
alias(),
vue(),
Components({
resolvers: [VantResolver()],
}),
topLevelAwait({
promiseExportName: "__tla",
promiseImportName: i => `__tla_${i}`
})
],
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
css: {},
build: {
emptyOutDir: true,
outDir
}
};
});