7

I am building an app that stores user generated images. These images get used throughout the app in a gallery type view. They also update/regenerate frequently.

The problem I am having is when a new image gets generated, I am storing it in the public directory. This causes the meteor server to "restart".

Is there a way to turn off file watching?

3

4 Answers 4

2
  1. I don't think it is possible as for now

  2. Even if you could stop to watch it would not solve your issue

When meteor detect a change it rebuild the server (.meteor/local/build/) and serve it from there.

Public folder is sent there : ".meteor/local/build/static/"

In a case where you would stop watching for updates you would also stop to see changes in what your client can access.

I found out that this particular case can be solved by replacing meteor by another tool to deal with static assets.

I have a meteor app to deal with data and file sync, but I also keep an Apache to serve as a file distribution manager.

My meteor app keep small, assets can be sent somewhere else (Ex.: S3 when you get in production).

1

I just found an answer on a similar question on this website that I think might help if you haven't found a solution yet.

I finally found a workaround. I'm putting everything in /public/lib/. Then, line 286 of /usr/lib/meteor/app/run.js, I'm adding the folder I don't want Meteor to watch: self.exclude_paths = [ path.join(app_dir, '.meteor', 'local'), path.join(app_dir, 'public', 'lib') ]; This way I can have as much files as I want in lib, and they don't slow everything down. include path is '/lib/dojo/dojo.js'.

by Mathieu

1
  • As for 2023, can't make it work. I can't find /usr/lib/meteor/app/run.js; my Meteor runs from /home/user/.meteor, hope it is proper folder. But I can't locate app/run.js and can't grep the "exclude_paths" line.
    – RollingHog
    Mar 2, 2023 at 9:15
0

I ended up exporting the file to an S3 bucket so that it didn't effect the Meteor watching.

0

I like to use develop mode for small-mid project as well, saving files to /public is terrible idea.

Recommand Meteor-Files Save all files like json data into the mongodb or s3, and use it like the file you have in local.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.