Why is package adding to bundle size although I'm not importing it?

We have a Blaze project that I just added React to. Meteor 1.5.

We don’t import React anywhere in the project, but when I use bundle-visualizer straight after adding it, I see it’s added a few hundred kb to the project.

Why is this? I was hoping to start using React by dynamically loading it where needed and incrementally moving over the Blaze app to React. But even without doing the import, React is getting loaded. How could this be?

Hi @elie ,

How do you add React via Atmosphere or NPM?

meteor npm install --save react react-dom

Well… quick guess there is dependent packages (already imported to the Client) which require React.
bundle-visualizer shows direct dependency?

Could it be a weak dependency of another package?

It lists it as an npm module in visualizer. My largest one in fact.


Could it be a weak dependency of another package?

For NPM - yes.
For Atmosphere - no, only other Atmosphere package can be a weak dependency.

I believe meteor npm ls can put a beam of light.

So apparently the issue is with:

This package imports it even if I don’t import in the app. Would making a PR to this package help fix that?

react-template-helper as I can see from package name it’s heavily depends from React. And my guess it wont work without React.