Skip to content

Commit

Permalink
Externalize more dependencies in build
Browse files Browse the repository at this point in the history
  • Loading branch information
cephalization committed Nov 13, 2024
1 parent 4b1a05c commit 0b4f440
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"size-limit": "^7.0.8",
"storybook": "^8.0.9",
"three": "^0.153.0",
"tslib": "^2.8.1",
"typescript": "^5.6.3",
"vite": "^5.4.11",
"vitest": "^2.1.5"
Expand Down
13 changes: 12 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,24 @@ export default mergeConfig(
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ["react", "react-dom"],
external: [
"react",
"react-dom",
"@react-three/fiber",
"@react-three/drei",
"three",
"three-stdlib",
],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
react: "React",
"react-dom": "ReactDOM",
"@react-three/fiber": "ReactThreeFiber",
"@react-three/drei": "ReactThreeDrei",
three: "Three",
"three-stdlib": "ThreeStdlib",
},
},
},
Expand Down

0 comments on commit 0b4f440

Please sign in to comment.