diff --git a/ember-cli-build.js b/ember-cli-build.js
index d690a25..9d072b4 100644
--- a/ember-cli-build.js
+++ b/ember-cli-build.js
@@ -1,6 +1,7 @@
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
+const Funnel = require('broccoli-funnel');
module.exports = function(defaults) {
let app = new EmberApp(defaults, {
@@ -20,5 +21,7 @@ module.exports = function(defaults) {
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
- return app.toTree();
+ return new Funnel(app.toTree(), {
+ exclude: ['file-to-exclude'],
+ });
};
您应该显式地将broccoli-funnel添加到依赖项中,即使它可以作为间接依赖项使用:
// if using npm
npm install -D broccoli-funnel
// if using yarn
yarn add -D broccoli-funnel
1条答案
按热度按时间3hvapo4f1#
Ember使用Broccoli.js作为它的构建管道。Broccoli是围绕树的概念构建的。请查看it's documentation以了解详细信息。
您可以使用名为broccoli-funnel的插件从树中排除文件。它需要一个输入节点,该节点可以是作为字符串的目录名,也可以是作为第一个参数的现有broccoli树。应该提供一个配置对象作为第二个参数。应该排除的文件或文件夹可以由该对象上的
exclude
选项指定。broccoli树是在
ember-cli-build.js
的构建过程中创建的。从该文件导出的函数应该返回一个树。默认情况下,它直接返回由app.toTree()
创建的树。但您可以在之前使用broccoli-funnel自定义该树。此差异显示了如何自定义Ember CLI 3.16.0蓝图提供的默认
ember-cli-build.js
以排除特定文件:您应该显式地将
broccoli-funnel
添加到依赖项中,即使它可以作为间接依赖项使用:Broccoli-funnel不仅支持精确的文件名,还支持正则表达式、全局字符串或函数来定义要排除的文件。请查看它的文档以了解详细信息。