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.
34 lines
858 B
34 lines
858 B
2 years ago
|
import path from 'path';
|
||
|
import { defineConfig } from 'vite'
|
||
|
import react from '@vitejs/plugin-react'
|
||
|
import reactRefresh from '@vitejs/plugin-react-refresh'
|
||
|
|
||
|
// https://vitejs.dev/config/
|
||
|
export default defineConfig({
|
||
|
root: './client/',
|
||
|
plugins: [react({})],
|
||
|
// plugins: [reactRefresh({})],
|
||
|
resolve: {
|
||
|
alias: [
|
||
|
{
|
||
|
find: '$utils', replacement: path.join('/src/utils'),
|
||
|
},
|
||
|
{
|
||
|
find: '$components', replacement: path.join('/src/components'),
|
||
|
},
|
||
|
// 针对以 ~/[包名称]开头的,替换为 node_modules/@[包名称]
|
||
|
{
|
||
|
find: /^(~)(?!\/)(.+)/, replacement: path.join('node_modules/$2'),
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
cors: true,
|
||
|
server: {
|
||
|
hmr: {
|
||
|
protocol: 'ws',
|
||
|
host: 'localhost'
|
||
|
},
|
||
|
middlewareMode: 'html',
|
||
|
}
|
||
|
})
|