Remove a particular file/folder from the app tree depends upon the build environment

I’m trying to remove a folder (app/utils/dev) from the app folder during the production build. I tried using broccoli-file-remover to remove the folder from app tree. But it’s not working for some reason :frowning:

appTree = removeFile(appTree, {
   path: 'app/utils/dev'

I think app tree will not maintain the app’s folder structure. But, I’m not sure.

Any suggestions?

I think the easiest thing to do would be to using broccoli-funnel with an exclude pattern.

Complete pseudo code, but might look something like:

const Funnel = require('broccoli-funnel');
const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = require(defaults) {
  let trees = {};

  if (EmberApp.env() === 'production') { = new Funnel('app', {
      exclude: ['utils/dev/**'],

  let app = new EmberApp(defaults, {

  return app.toTree();

Thanks for the suggestion @rwjblue will try it :+1:t2::+1:t2:

:star_struck: that works perfectly with a small tweak, the key excludes doesn’t work but exclude does! However, it takes a while for me to recognize :stuck_out_tongue_closed_eyes:. Thanks a lot @rwjblue

I updated Rob’s code sample above to remove the typo, to help future readers of this thread.

1 Like