I have a Meteor app, which uses a bunch of plugins. These are all in a monorepo (https://github.com/chili-epfl/FROG), and I use yarn to symlink in the dependencies - I don’t know if this makes a difference.
The app has been in development for almost a year, and we’re now getting ready to run it in production. When I run
meteor --production, and the
bundle-visualizer, I see that the whole bundle is 8.2MB, but packages are duplicated like crazy. For example, all of my plugins (separate NPM packages) depend on a common “utils” package, and this is imported 10 times, same with React, lodash etc.
Is there something special I need to do to dedupe packages? As far as I know, all of the sub-dependencies (React, lodash etc) are in sync (the same versions), and for each dependency, I only want a single copy in the bundle.