pmndrs / use-cannon

👋💣 physics based hooks for @react-three/fiber
https://cannon.pmnd.rs
2.74k stars 154 forks source link

fix: don't inline cannon-es #296

Closed alexandernanberg closed 2 years ago

alexandernanberg commented 2 years ago

Found out while trying to debug some things that cannon-es and cannon-es-debugger are inlined in the use-cannon bundle. Not sure if this is intentional or not?

They are listed as dependencies of this package so consumers will download the code twice on npm install. It also makes it harder to debug things locally, e.g. I tried to change some things in node_modules/cannon-es but didn't understand why the changes didn't go through

When building we get this warning

Use output.globals to specify browser global variable names corresponding to external modules
cannon-es (guessing 'cannonEs')

not sure if we should care about it or not

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pmndrs/use-cannon/5kWXGMGX8saST1y7GHSStbDZjeqE
✅ Preview: https://use-cannon-git-fork-alexandernanberg-make-cannon-88e339-pmndrs.vercel.app

bjornstar commented 2 years ago

We need cannon-es inlined for the worker where the cannon code is actually run.

I will say that we can move cannon-es to a devDependency since it is already bundled in the distribution.

alexandernanberg commented 2 years ago

Oh makes sense 👍