28 lines
867 B
TypeScript
28 lines
867 B
TypeScript
import react from '@vitejs/plugin-react';
|
|
import { exec } from 'child_process';
|
|
import path from 'path';
|
|
import { promisify } from 'util';
|
|
import { defineConfig, PluginOption } from 'vite';
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()] as PluginOption[],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
'@/lib': path.resolve(__dirname, './src/lib'),
|
|
utils: path.resolve(__dirname, './src/utils'),
|
|
assets: path.resolve(__dirname, './src/assets'),
|
|
context: path.resolve(__dirname, './src/context'),
|
|
components: path.resolve(__dirname, './src/components'),
|
|
pages: path.resolve(__dirname, './src/pages'),
|
|
},
|
|
},
|
|
define: {
|
|
'process.env': {},
|
|
__VERSION__: JSON.stringify(
|
|
(await promisify(exec)('git rev-parse --short HEAD')).stdout.trim(),
|
|
),
|
|
},
|
|
});
|