client-react/vite.config.js (32 lines of code) (raw):
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import fs from 'fs/promises';
// https://vitejs.dev/config/
export default defineConfig({
esbuild: {
loader: "jsx",
include: /src\/.*\.jsx?$/,
// loader: "tsx",
// include: /src\/.*\.[tj]sx?$/,
exclude: [],
},
optimizeDeps: {
esbuildOptions: {
plugins: [
{
name: "load-js-files-as-jsx",
setup(build) {
build.onLoad({ filter: /src\/.*\.js$/ }, async (args) => ({
loader: "jsx",
contents: await fs.readFile(args.path, "utf8"),
}));
},
},
],
},
},
plugins: [
react({
babel: {
plugins: ['babel-plugin-macros'],
},
}),
],
});