如何从 Meteor 的打包器中排除目录/文件 [英] How to exclude directories/files from Meteor's bundler
问题描述
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.
谢谢.
推荐答案
bundler (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
目录中.除非您要求捆绑测试,否则不包括在内.
Another approach is to place the files in a test
directory. Unless you request to bundle tests, this is excluded.
最后一种方法是将文件放在 packages
目录下.我认为您甚至不需要存根 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.
这两个选项都有点笨拙,但非常实用.
Both of these options are a little bit hacky, but perfectly serviceable.
我认为如果有类似于 .gitignore
的类似 .meteorignore
的东西就好了.
I think it would be nice if there was something like .meteorignore
akin to .gitignore
.
这篇关于如何从 Meteor 的打包器中排除目录/文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!