Does every npm package included in the client bundle?

Hi,

a quick question: If I add an npm package with meteor npm install --save ..., but never import/require it from client files, will it be included in the bundle generated for the client? I’m using quite a few in the backend, but want to avoid sending too much unnecessary data to the client, so the other option is to split the app into 2 parts, which seems pretty inconvenient…

Thanks!

I just had some doubts about this, but I double-checked. For a package to be part of the client bundle, it needs to be actually imported from client-side code. So you shouldn’t send any unnecessary data to the client.

1 Like