x
This commit is contained in:
@@ -1,24 +1,42 @@
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import { existsSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss()],
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
assetsDir: 'assets',
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8000',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/rest': {
|
||||
target: 'http://localhost:3000',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/rest/, ''),
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
const oxideVendored = [
|
||||
join(__dirname, 'vendor', 'tailwindcss-oxide.linux-x64-gnu.node'),
|
||||
join(__dirname, 'vendor', 'tailwindcss-oxide.linux-x64-musl.node'),
|
||||
]
|
||||
for (const p of oxideVendored) {
|
||||
if (existsSync(p)) {
|
||||
process.env.NAPI_RS_NATIVE_LIBRARY_PATH = p
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
export default defineConfig(async () => {
|
||||
const { default: tailwindcss } = await import('@tailwindcss/vite')
|
||||
return {
|
||||
plugins: [react(), tailwindcss()],
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
assetsDir: 'assets',
|
||||
chunkSizeWarningLimit: 750,
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8000',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/rest': {
|
||||
target: 'http://localhost:3000',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/rest/, ''),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user