From db3e46ae7cc491f74ce11edb96d8f4251ff28d67 Mon Sep 17 00:00:00 2001 From: Madeorsk Date: Mon, 23 Sep 2024 00:06:37 +0200 Subject: [PATCH] Fix dev and production builds with React. --- package.json | 2 ++ vite.config.ts | 2 +- yarn.lock | 45 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 945d898..a48db92 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,8 @@ "@types/uuid": "^10", "@vitejs/plugin-react": "^4.3.0", "less": "^4.2.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", "typescript": "^5.4.5", "vite": "^5.2.11", "vite-plugin-dts": "^3.9.1" diff --git a/vite.config.ts b/vite.config.ts index be8fc31..bb0ffce 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -16,7 +16,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { fileName: "index", }, rollupOptions: { - external: ["react"], + external: ["react", "react-dom"], }, }, diff --git a/yarn.lock b/yarn.lock index 40630a3..5a404e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -574,6 +574,8 @@ __metadata: "@types/uuid": "npm:^10" "@vitejs/plugin-react": "npm:^4.3.0" less: "npm:^4.2.0" + react: "npm:^18.3.1" + react-dom: "npm:^18.3.1" react-merge-refs: "npm:^2.1.1" react-router-dom: "npm:^6.24.1" typescript: "npm:^5.4.5" @@ -1810,7 +1812,7 @@ __metadata: languageName: node linkType: hard -"js-tokens@npm:^4.0.0": +"js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": version: 4.0.0 resolution: "js-tokens@npm:4.0.0" checksum: 10c0/e248708d377aa058eacf2037b07ded847790e6de892bbad3dac0abba2e759cb9f121b00099a65195616badcb6eca8d14d975cb3e89eb1cfda644756402c8aeed @@ -1924,6 +1926,17 @@ __metadata: languageName: node linkType: hard +"loose-envify@npm:^1.1.0": + version: 1.4.0 + resolution: "loose-envify@npm:1.4.0" + dependencies: + js-tokens: "npm:^3.0.0 || ^4.0.0" + bin: + loose-envify: cli.js + checksum: 10c0/655d110220983c1a4b9c0c679a2e8016d4b67f6e9c7b5435ff5979ecdb20d0813f4dec0a08674fcbdd4846a3f07edbb50a36811fd37930b94aaa0d9daceb017e + languageName: node + linkType: hard + "lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": version: 10.2.2 resolution: "lru-cache@npm:10.2.2" @@ -2305,6 +2318,18 @@ __metadata: languageName: node linkType: hard +"react-dom@npm:^18.3.1": + version: 18.3.1 + resolution: "react-dom@npm:18.3.1" + dependencies: + loose-envify: "npm:^1.1.0" + scheduler: "npm:^0.23.2" + peerDependencies: + react: ^18.3.1 + checksum: 10c0/a752496c1941f958f2e8ac56239172296fcddce1365ce45222d04a1947e0cc5547df3e8447f855a81d6d39f008d7c32eab43db3712077f09e3f67c4874973e85 + languageName: node + linkType: hard + "react-merge-refs@npm:^2.1.1": version: 2.1.1 resolution: "react-merge-refs@npm:2.1.1" @@ -2343,6 +2368,15 @@ __metadata: languageName: node linkType: hard +"react@npm:^18.3.1": + version: 18.3.1 + resolution: "react@npm:18.3.1" + dependencies: + loose-envify: "npm:^1.1.0" + checksum: 10c0/283e8c5efcf37802c9d1ce767f302dd569dd97a70d9bb8c7be79a789b9902451e0d16334b05d73299b20f048cbc3c7d288bbbde10b701fa194e2089c237dbea3 + languageName: node + linkType: hard + "resolve@npm:~1.19.0": version: 1.19.0 resolution: "resolve@npm:1.19.0" @@ -2473,6 +2507,15 @@ __metadata: languageName: node linkType: hard +"scheduler@npm:^0.23.2": + version: 0.23.2 + resolution: "scheduler@npm:0.23.2" + dependencies: + loose-envify: "npm:^1.1.0" + checksum: 10c0/26383305e249651d4c58e6705d5f8425f153211aef95f15161c151f7b8de885f24751b377e4a0b3dd42cce09aad3f87a61dab7636859c0d89b7daf1a1e2a5c78 + languageName: node + linkType: hard + "semver@npm:^5.6.0": version: 5.7.2 resolution: "semver@npm:5.7.2"