fix: move back to react-scripts

This commit is contained in:
ckt1031
2023-07-09 21:18:22 +08:00
parent 28d58849a0
commit 2ae5741214
7 changed files with 1641 additions and 800 deletions

View File

@@ -1,33 +0,0 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import * as esbuild from "esbuild";
import fs from 'fs/promises';
export default defineConfig(() => ({
plugins: [react()],
build: {
outDir: './build',
},
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"),
}));
},
},
],
},
},
}));