Template
Inital template
This commit is contained in:
commit
54faec3540
62 files changed
+6808
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import react, { reactCompilerPreset } from '@vitejs/plugin-react'
|
||||
import babel from '@rolldown/plugin-babel'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import { defineConfig, type Plugin } from 'vite'
|
||||
import { startMockServer } from './mock/server.mjs'
|
||||
|
||||
// Runs the mock API (mock/server.mjs) during `vite dev` and kills it on exit.
|
||||
function mockApi(): Plugin {
|
||||
let server: ReturnType<typeof startMockServer> | undefined
|
||||
return {
|
||||
name: 'mock-api',
|
||||
configureServer(devServer) {
|
||||
server = startMockServer()
|
||||
devServer.httpServer?.once('close', () => server?.close())
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss(), babel({ presets: [reactCompilerPreset()] }), mockApi()],
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': 'http://localhost:8787',
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in new issue
Block a user