From a54c18e89b31b5530fa43fdfa7b491d34e47b159 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Fri, 28 Jul 2023 10:32:50 +0500 Subject: [PATCH] web: remove require transform plugin --- apps/web/vite.config.ts | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index 76b0baa03..1e2e60a13 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { Plugin, PluginOption, defineConfig } from "vite"; +import { PluginOption, defineConfig } from "vite"; import react from "@vitejs/plugin-react-swc"; import svgrPlugin from "vite-plugin-svgr"; import envCompatible from "vite-plugin-env-compatible"; @@ -112,8 +112,6 @@ export default defineConfig({ }) as PluginOption ] : []), - - requireTransformPlugin(), ...(isDesktop && process.env.NODE_ENV === "production" ? [] : [ @@ -140,17 +138,3 @@ export default defineConfig({ }) ] }); - -function requireTransformPlugin(): Plugin { - return { - transform(code, id) { - if (/\/node_modules\//g.test(id)) return; - if (!/require/.test(code)) return; - - return { - code: code.replace(/require\(/gm, "await import(") - }; - }, - name: "require-transform-plugin" - }; -}