My monorepo looks as follows:
- app1
- packages/package1
- packages/packageN
This is a yarn 3 monorepo with turborepo for caching build assets.
- App1 consumes package1.
- App1 is a simple Vite React app.
- Package1 is a react component library. Also uses Vite and react.
- TypeScript is used across the board.
- I do not use babel directly anywhere.
On initial setup, app1 was directly consuming package1 without a build step in between. This seemed reasonable since they all live in the same monorepo. However, massive performance issues and hundreds of messages like these:
@app1: [BABEL] Note: The code generator has deoptimised the styling of ... as it exceeds the max of 500KB.
@app1: [BABEL] Note: The code generator has deoptimised the styling of ... as it exceeds the max of 500KB.
...
@app1: [BABEL] Note: The code generator has deoptimised the styling of ... as it exceeds the max of 500KB.
caused me to pick another route, which was to build package1 and consume it in app1. This did help, until now, where the same behavior described above is happening even with the built version of package1.
I'm unable to pinpoint the root cause of this. My closest assumption is Vite misconfiguration for a monorepo, but I haven't had much luck there when researching options.
What is the potential cause of app1 having performance issues in this setup and also outputting many of the warning above?