Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude directories/files from Meteor's bundler

Meteor watches the current project's directory for file changes so that it can automatically restart the server.

As my project grew in size, I noticed that the time it takes for each "refresh" has gone up from ~1 seconds to 8+ seconds.

I'm looking to exclude some files and directories, and I'm wondering if I should edit app/lib/bundler.js or if there's a better way.

Thanks.

like image 808
Dave Avatar asked May 20 '13 07:05

Dave


2 Answers

Another way is to prefix folders you want to exclude with a period.

like image 93
Kendrick Ledet Avatar answered Sep 19 '22 07:09

Kendrick Ledet


The bundler (tools/bundler.js) has a list of regexps that it ignores:

// files to ignore when bundling. node has no globs, so use regexps
var ignore_files = [
    /~$/, /^\.#/, /^#.*#$/,
    /^\.DS_Store$/, /^ehthumbs\.db$/, /^Icon.$/, /^Thumbs\.db$/,
    /^\.meteor$/, /* avoids scanning N^2 files when bundling all packages */
    /^\.git$/ /* often has too many files to watch */
];

Another approach is to place the files in a test directory. Unless you request to bundle tests, this is excluded.

One final approach is is to put files under the packages directory. I don't think you even need to have a stub package.js file.

Both of these options are a little bit hacky, but perfectly serviceable.

I think it would be nice if there was something like .meteorignore akin to .gitignore.

like image 37
StephenD Avatar answered Sep 23 '22 07:09

StephenD