diff --git a/web/public/index.html b/web/index.html similarity index 91% rename from web/public/index.html rename to web/index.html index b8e324d2..c67ee563 100644 --- a/web/public/index.html +++ b/web/index.html @@ -14,5 +14,6 @@
+ diff --git a/web/package.json b/web/package.json index a2bf3054..721deb3b 100644 --- a/web/package.json +++ b/web/package.json @@ -3,22 +3,22 @@ "version": "0.1.0", "private": true, "dependencies": { - "axios": "^0.27.2", + "axios": "^1.4.0", "history": "^5.3.0", - "marked": "^4.1.1", + "marked": "^5.1.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-dropzone": "^14.2.3", - "react-router-dom": "^6.3.0", + "react-router-dom": "^6.14.1", "react-scripts": "5.0.1", - "react-toastify": "^9.0.8", - "react-turnstile": "^1.0.5", + "react-toastify": "^9.1.3", + "react-turnstile": "^1.1.1", "semantic-ui-css": "^2.5.0", - "semantic-ui-react": "^2.1.3" + "semantic-ui-react": "^2.1.4" }, "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", + "start": "vite preview", + "build": "vite build", "test": "react-scripts test", "eject": "react-scripts eject" }, @@ -41,7 +41,9 @@ ] }, "devDependencies": { - "prettier": "^2.7.1" + "@vitejs/plugin-react": "^4.0.2", + "prettier": "^2.7.1", + "vite": "^4.4.2" }, "prettier": { "singleQuote": true, diff --git a/web/vite.config.js b/web/vite.config.js new file mode 100644 index 00000000..5a3c43ab --- /dev/null +++ b/web/vite.config.js @@ -0,0 +1,44 @@ +import fs from "node:fs"; +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' +import * as esbuild from "esbuild"; + +const sourceJSPattern = /\/src\/.*\.js$/; +const rollupPlugin = (matchers) => ({ + name: "js-in-jsx", + load(id) { + if (matchers.some(matcher => matcher.test(id))) { + const file = fs.readFileSync(id, { encoding: "utf-8" }); + return esbuild.transformSync(file, { loader: "jsx" }); + } + } +}); + +export default defineConfig({ + plugins: [ + react() + ], + build: { + outDir: "./build", + rollupOptions: { + plugins: [ + rollupPlugin([sourceJSPattern]) + ], + }, + commonjsOptions: { + transformMixedEsModules: true, + }, + }, + optimizeDeps: { + esbuildOptions: { + loader: { + ".js": "jsx", + }, + }, + }, + esbuild: { + loader: "jsx", + include: [sourceJSPattern], + exclude: [], + }, +});