pixijs / pixi-react

Write PIXI apps using React declarative style
https://pixijs.io/pixi-react/
MIT License
2.26k stars 173 forks source link

Improve the bundle size #356

Closed brunobispo closed 1 year ago

brunobispo commented 1 year ago

Description

I'm trying to use this library to develop a TV app. It's everything going well, except the resulting bundle size. I noticed some aspects that is causing some waste in this matters that I would like to work on:

  1. Not setting the sideEffects config in package.json is preventing the bundler from tree shaking unused code;
  2. Importing modules instead of the whole pixi.js package might result in a smaller package (to be validated);
  3. Duplicating the bundle into @inlet/react-pixi/animated instead of importing from @inlet/react-pixi results in duplication on the app using it as well.

I'd love start working on these ideas, but I'd like to hear your thoughts first.

Thanks and congrats for the amazing work!

Additional info

baseten commented 1 year ago

@brunobispo with the release of @pixi/react v7.0.0.alpha-2 today, the last of these suggestions is complete, this version pulls in pixi modules instead of the whole package.

sideEffects: false and splitting animated out of the main package (@pixi/react-animated) was introduced in v7.0.0.alpha-1.

Hope this helps!