Why does Meteor insist on pulling down ALL /public images


#1

I’m Trying to speed up my website, and it looks like Meteor wants to pull down ALL IMAGES found in /public

So if I have some files there that are large, it wants them all.

Why is this? How can I limit to only files that are necessary??


#2

You mean like dynamic imports, for the /public folder?


#3

By design, Meteor lazily loads/pulls everything from the /public folder down to the client. I rarely use the /public directory for anything, except for favicons. The /public directory is used to store all files that are meant to be served publicly. Images, graphics, and other static assets can live here. You should host your images, font files etc somewhere else…like s3 to speed up ‘parallel’ loading. You can also place large files in the imports directory and import them where needed.

import samplePhoto from 'imports/.../samplePhoto.png'
...
const photo = new Image();
photo.src = samplePhoto
...

#4

Doesn’t galaxy take images in the public folder and upload them to S3 as part of the build/upload process?


#5

The point is, if I had 1000 images, Meteor would pull them… ALL


#6

Not really. I think Galaxy bundles your app along with the /public directory in the generated Docker container before initiating it on the EC platform. I have experienced issues like this before and I just switched to hosting my images and other important assets in an S3 bucket for a smooth CDN effect.