如何从Meteor的捆绑器中排除目录/文件

问题描述:

Meteor监视当前项目的目录以进行文件更改,以便它可以自动重启服务器。

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

随着项目规模的扩大,我注意到每次刷新所需的时间从大约1秒增加到8秒以上。

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.

我想要排除一些文件和目录,我想知道是否应该编辑app / lib / bundler.js或者是否有更好的方法。

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.

谢谢。

捆绑商( tools / bundler。 js )有一个它忽略的正则表达式列表:

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 */
];

另一种方法是将文件放在 test $ c $中c>目录。除非您要求捆绑测试,否则不包括。

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

最后一种方法是将文件放在下目录。我认为您甚至不需要存根 package.js 文件。

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.

这两个选项都是有点hacky,但完全可以服务。

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

我认为如果有类似 .meteorignore 的话会很好类似于 .gitignore

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