Skip to content

Commit

Permalink
Merge pull request #121 from smoores-dev/main
Browse files Browse the repository at this point in the history
Properly externalize bundles (and move React to peer dep)
  • Loading branch information
Saifullah-dev authored Dec 29, 2024
2 parents 48b3ceb + aa3d4f7 commit 8450ee0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
33 changes: 29 additions & 4 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
"semantic-release": "semantic-release"
},
"dependencies": {
"react": "^18.3.1",
"react-collapsible": "^2.10.0",
"react-dom": "^18.3.1",
"react-icons": "^5.2.1",
"react-loading": "^2.0.3"
},
Expand All @@ -35,10 +33,16 @@
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sass": "^1.77.6",
"semantic-release": "^24.1.0",
"vite": "^5.4.6"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
},
"description": "React File Manager is an open-source, user-friendly component designed to easily manage files and folders within applications. With smooth drag-and-drop functionality, responsive design, and efficient navigation, it simplifies file handling in any React project.",
"main": "src/index.js",
"repository": {
Expand Down
10 changes: 9 additions & 1 deletion frontend/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import packageJson from "./package.json";

// https://vitejs.dev/config/
export default defineConfig({
Expand All @@ -13,7 +14,14 @@ export default defineConfig({
formats: ["es"],
},
rollupOptions: {
external: ["react", "react-dom"],
external: [
...Object.keys(packageJson.dependencies).map(
(mod) => new RegExp(`^${mod}`)
),
...Object.keys(packageJson.peerDependencies).map(
(mod) => new RegExp(`^${mod}`)
),
],
output: {
globals: {
react: "React",
Expand Down

0 comments on commit 8450ee0

Please sign in to comment.