-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
21 lines (19 loc) · 931 Bytes
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import {defineConfig, Plugin, ViteDevServer} from 'vite';
import react from '@vitejs/plugin-react';
import path from 'node:path';
import consola from 'consola';
import chalk from 'chalk';
const Logger: Plugin = {
name: 'logger',
transform(src, id: any) {id = id.split('/'); consola.log(`Transforming ${chalk.gray(`${id.slice(0, -1).join('/')}/`)}${chalk.cyan(chalk.bold(id[id.length - 1]))}`); return null;},
configureServer(server: ViteDevServer) {
server.config.logger.info = (text) => consola.log(text.replace('hmr', 'HMR').replace('server restart', 'Server restart').replace('page reload', 'Page reload'));
server.config.logger.error = (text) => consola.error(text);
server.config.logger.warn = (text) => consola.warn(text);
}
}
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), Logger],
resolve: {alias: {'@': path.resolve(__dirname, 'src')}}
});