feat: 更新项目代码
This commit is contained in:
32
InfoGenie-frontend/vite.config.js
Normal file
32
InfoGenie-frontend/vite.config.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { defineConfig, transformWithEsbuild } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
// Allow JSX in .js files (all files under src/)
|
||||
{
|
||||
name: 'treat-js-as-jsx',
|
||||
async transform(code, id) {
|
||||
if (!id.match(/\/src\/.*\.js$/)) return null;
|
||||
return transformWithEsbuild(code, id, { loader: 'jsx' });
|
||||
},
|
||||
},
|
||||
react({ include: '**/*.{jsx,js}' }),
|
||||
tailwindcss(),
|
||||
],
|
||||
resolve: {
|
||||
alias: { '@': path.resolve(__dirname, './src') },
|
||||
},
|
||||
base: '/',
|
||||
server: { port: 3000 },
|
||||
optimizeDeps: {
|
||||
esbuildOptions: {
|
||||
loader: { '.js': 'jsx' },
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user