Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Provide way to not watch some files for auto-reload #437

drorm opened this Issue Oct 30, 2012 · 25 comments


None yet

drorm commented Oct 30, 2012

Since it's not loaded automatically, public directory should not be watched and cause the app to reload.

Watching the public directory is useful when saving images (which are part of a page's design) into a meteor project, as the page updates when those images change, refreshing the design live whenever you slice and save an image from Photoshop.

drorm commented Oct 30, 2012

The public page is the only place where you can store things that will not load automatically with the app.
describes a major issue with auto-reloading.

The alternative is to provide a way to tell meteor not to include other portions of tree. Maybe 'noload' directories anywhere in the tree do not load or trigger reload.


dgreensp commented Nov 16, 2012

What kind of files are you putting in the public directory, and why don't you want the app to reload?

heavyk commented Nov 16, 2012

if you want a public directory not to be watched, terminate the directory name with ~ like ... public/ignored~

drorm commented Nov 16, 2012

  • I have my docs in the public directory, and every time I update them the app reloads and it's annoying.
  • As mentioned in http://stackoverflow.com/questions/11504883/how-to-prevent-meteor-from-watching-files it's an issue when you have lots of files
  • As mentioned on meteor-talk, if you have your app create a file for download in the public dir, you can't test it, since every time you create a file the app reloads before you can download the file.

@heavyk suggestion sounds like an OK workaround for now. Is that official? If so, we can get Tom to add it to the FAQ and close this.

heavyk commented Nov 16, 2012

I dunno how official it is, I just know that code, and it says that any file or folder ending with ~ is ignored. obviously the bundler will not include these files either, so if you want to distribute the bundle properly, you will have to do some sort of transform on your bundle, adding those files manually (or something like that).


dgreensp commented Nov 16, 2012

It sounds like the request is to provide a way to exclude files from being watched, so that they don't cause app reloads. I've definitely wanted this before.

Uses include:

  • Files that are never actually loaded by the app, just in the app's directory tree
  • Static assets created by the app in its directory tree -- I'm not sure if this is intentionally supported in production or not, but apparently it works(?), but causes a reload in local testing
  • Static assets thrown into public that may or may not be used by the app

I agree that unwanted reloads can be annoying. I don't think just not watching public is an option. It's a matter of finding the right interface for this.

drorm commented Nov 16, 2012

OK, that's a good compromise.
Provide a way to exclude files/directories from causing a reload.

My vote would be that a ".noreload" file in a directory results in the directory and everything under it not to reload. It has the advantages:

  • flexible. Gives you full control of what does and doesn't get reloaded in the whole public tree (do we need to limit it to public for that matter?).
  • Easy to describe
  • Unobtrusive, since it's a dot file, it doesn't show up normally
  • Shouldn't be too hard to implement.

I just ran into this problem when trying to upload image files up to the public directory. Every upload was causing a server reload, and the browser was losing its socket connection. I'd reload the browser window and be back in business, but I had to reload the browser manually after every image upload.

I solved the problem by adding a ~ to the end of the image folder name, so it doesn't keep reloading. Now I have to see if I can get the ignored image directory to serve its images up even though it's been ignored.

Maskime commented Jan 30, 2013

Hi everyone,

I can't make Meteor serve the files inside the "ignored~" dir.
More than that, if I try to write inside this dir using fs, I get a "Path does not exists" error. Did anyone finally succeed into uploading a file without making Meteor reload the page ?



awwx commented Jan 30, 2013

Note that there are two different issues here:

  1. To be able to serve files that are created or changed at runtime (such as files that are uploaded). This can be accomplished by creating a smart package which serves files out of its own directory, e.g. __meteor_bootstrap__.app.use(connect.static('mydir'))

Note that it's a bad idea to be serving dynamically changing files out of the bundler's static directory. The bundler creates a static distribution (... which is why it's called "static"...), which in turn means that smart packages such as app cache support can rely on the files not changing, etag's can be implemented based on the (unchanging) static file hash, and so on. Dynamically changing files have different caching and etag requirements, and so are better served out of a directory that can implement those policies.

  1. To be able to change static bundled resources such as images without triggering a code reload. This can be done today by using the SERVER_ID environmental variable, which can be set to indicate whether a change is a "major" change (that needs a reload) or a "minor" change.

It would certainly be possible to have a convenient interface that said "files matching this pattern" don't need to trigger a code reload, which would be easier to use than setting SERVER_ID. But keep in mind that this is not a good way to support file uploads... so if you want file uploads, you should write a smart package to do that and/or file a separate issue for file upload support (if there's something else needed from Meteor to support that).

Maskime commented Jan 31, 2013

@awwx : Understood that I was off topic, I will create a new issue

I tried this approach suggested by someone in : http://stackoverflow.com/a/13324447

Meteor.startup(function () {
var require = meteor_bootstrap.require;
var fs = require('fs');

  fs.symlinkSync('../../../../uploads', '.meteor/local/build/static/uploads'); 


This works great locally, i can upload files to the uploads folder without any reloads but unfortunately fails on deployment to meteor.com. The log shows :

[Sat Mar 02 2013 15:36:41 GMT+0000 (UTC)] INFO Error: ENOENT, no such file or directory '.meteor/local/build/static/uploads'
at Object.fs.symlinkSync (fs.js:561:18)
at app/server/fileupload.js:5:8
at run (/meteor/containers/9a04a4e6-4f7f-81d1-d562-9630d0017599/bundle/server/server.js:272:63)
at Array.forEach (native)
at Function..each..forEach (/meteor/dev_bundles/0.2.19/lib/node_modules/underscore/underscore.js:79:11)
at run (/meteor/containers/9a04a4e6-4f7f-81d1-d562-9630d0017599/bundle/server/server.js:272:7)
[Sat Mar 02 2013 15:36:41 GMT+0000 (UTC)] INFO STATUS running -> waiting
[Sat Mar 02 2013 15:36:41 GMT+0000 (UTC)] ERROR Application crashed with code: 1

I wonder if any of you have come up with a temporary solution for file uploads that also works when deployed to meteor.com

littke commented May 15, 2013

When working with .LESS files, I use CodeKit.app (or equivalent) to handle live CSS-reloading. I don't want Meteor to refresh the whole page then.

Lobosque commented Oct 7, 2013

http://stackoverflow.com/a/13324447 and http://stackoverflow.com/questions/14823783/how-to-disable-hot-code-push-in-meteor-js-in-development are not working.
Adding ~ to the end also does not work for me.
Any other idea to not auto-reload on file upload?

is there a way to support something like add ~ or fs.symlinkSync temporary?

dumski commented Jan 28, 2014

I have the same problem... It's very, very needed feature. Actually, it causes Meteor to be not fully functional framework for building web apps. How can we achieve dynamic image uploading for, lets say, blog post? Due to this problem we cannot event build simple blog app...

crsssl commented Feb 27, 2014

I have to second (third? fourth?) this, and cannot stress enough how this is a very real requirement. Some standard will have to be worked out so we can avoid all the kludges proposed so far. (E.g. using CDNs is great for production but what about dev?)

CollectionFS is be a good and interesting start, but a simple way of uploading, storing, and serving up actual image files (at the very least), without going through contortions and without our servers restarting (either in dev or production) is desperately needed.

Also: Note that "hot code push" should mean just that... only code changes should cause an app to reload. Data changes should be reactive, of course. And static files... well, the name says it all. (May I humbly suggest image file changes should behave the same way as data, if possible. But at the very least let us be able to store them somewhere in our directory tree that doesn't trigger the reload -- perhaps in a public/noreload directory.

Btw, I never got the ending-tilde (~) thing to work either, at least in dev.

jakl commented Mar 1, 2014

Prefixing a file or directory with .# works, but it also removes the client's ability to fetch it from ./public/ as a static asset. Definitely need a better solution.


This is how I stopped auto reload in MeteorJs

  1. If you have < 0.6.4 then copy the core reload package from meteor and put that in the package folder and then comment "// window.location.reload(); " part. This will automatically stop reload
  2. If you have > 0.6.4 then it's bit different here, overidding the core package i.e. copy and paste the

Reload._reload = function () { // 118

and paste it in your client.js file before startup

var reloading = false; // 117 Package.reload.Reload._reload = function () {
and then comment the "// window.location.reload(); " part. This will stop the reload in any cases.

See if that's works for you!


glasser commented Apr 18, 2014

We do not use GitHub to track feature requests (other than for Blaze). The core team's current roadmap is at https://roadmap.meteor.com/. Discussions about features that users desire are great topics for the meteor-talk mailing list, where the community can help come up with solutions that don't require core changes.

See specifically https://trello.com/c/mHK2dpr5/68-new-way-of-defining-packages-and-controlling-file-load-order

@glasser glasser closed this Apr 18, 2014

sferoze commented Jul 4, 2014

Even with the ~ at the end of the folder inside public meteor is still reloading.


anything saved into the directory reloads the server. I thought the ~ was supposed to stop this from happening?

jakl commented Jul 8, 2014

.# is ignored, like this for example:

patte added a commit to patte/meteor-appcache-extra that referenced this issue Aug 13, 2014

option to add content of folders (Meteor.AppCache.config.addPaths)
for each given addPaths: if it's a file, add it, if it's a directory, add the contained files
remove .# path prefixes to support adding folders hidden from meteor (see meteor/meteor#437)
recursively walking into subdirectories not supported by now

files get added to Meteor.settings.appcache.addedFiles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment