最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to exclude directoriesfiles from Meteor's bundler - Stack Overflow

programmeradmin1浏览0评论

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.

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.

Share Improve this question asked May 20, 2013 at 7:41 DaveDave 12.5k10 gold badges48 silver badges52 bronze badges 4
  • Are you editing a live bundled meteor app (created with meteor bundle xxx)? Is it you editing the files or changes to the file system by your app (e.g file uploads)? – Tarang Commented May 20, 2013 at 10:03
  • 3 add ~ to the end of folder like models~, it will treat as static ? – crapthings Commented May 20, 2013 at 10:53
  • Sry, I'm not editing a live bundled meteor app. Just developing with the meteor cmd. I think i was confused with another answer, so editing bundler.js is not the way to go. – Dave Commented May 20, 2013 at 19:14
  • @crapthings Thanks for the tip. It works! It does exclude the ("~" suffix'ed) folder completely from the project. So I need to remember to remove the "~" later on. Anyway, I'll accept your answer. =) – Dave Commented May 20, 2013 at 19:26
Add a comment  | 

2 Answers 2

Reset to default 12

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

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.

发布评论

评论列表(0)

  1. 暂无评论