vue3-h5-template/vite.config.ts
2024-08-30 19:14:26 +08:00

43 lines
968 B
TypeScript

import { createVitePlugins } from './config/vite/plugins';
import { resolve } from 'path';
import { ConfigEnv, UserConfigExport } from 'vite';
import inspector from 'vite-plugin-dev-inspector'
// import { viteMockServe } from 'vite-plugin-mock';
const pathResolve = (dir: string) => {
return resolve(process.cwd(), '.', dir);
};
// https://vitejs.dev/config/
export default function ({ command }: ConfigEnv): UserConfigExport {
const isProduction = command === 'build';
const root = process.cwd();
return {
root,
resolve: {
alias: [
{
find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js',
},
{
find: /\/@\//,
replacement: pathResolve('src') + '/',
},
],
},
server: {
host: true,
hmr: true,
},
plugins: [
createVitePlugins(isProduction),
inspector({
toggleButtonVisibility: 'never',
}),
],
};
}