39 lines
821 B
JavaScript
39 lines
821 B
JavaScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import path from 'path'
|
|
import fs from 'fs'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
base: './',
|
|
server: {
|
|
host: true,
|
|
allowedHosts: ['a6169b9d63c6.ngrok-free.app'],
|
|
strictPort: false,
|
|
cors: true,
|
|
historyApiFallback: true
|
|
},
|
|
plugins: [
|
|
react(),
|
|
tailwindcss(),
|
|
{
|
|
name: 'markdown-loader',
|
|
transform(code, id) {
|
|
if (id.endsWith('.md')) {
|
|
const content = fs.readFileSync(id, 'utf-8')
|
|
return {
|
|
code: `export default ${JSON.stringify(content)};`,
|
|
map: null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
})
|