[SOLVED] Reduce the size of modules.js

Hello,
I am trying to reduce the size of modules.js

I am using for example the npm sharp module.

I only use it server side.

Is it normal to have it in module.js that is on the client ?
I was expecting to have it only on the server

I have understand my error.

In a file.js that was loaded on both client and server :

if (Meteor.isServer) {

const myFunc = function() {
  const sharp = require("sharp");
  // blablabla
}

}

Even if this is writen isServer, sharp is loaded in modules.js

I solved my problem by writing this function inside the /server folder

And sharp is not loaded anymore in modules.js on the client bundle

1 Like