Why do all my files in Vendor compile without an app.import?

I’ve been trying to pare down my Vendor folder and sort out some redundant libraries in there and I’ve experienced some behavior I don’t quite understand:

  1. If I remove the app.import() from the ember-cli-build.js file for certain folders then check the compiled vendorjs in the Chrome network tool it still includes the very file that had the app.import() removed. Does it just compile everything in the vendor folder regardless of what you import in ember-cli-build?

  2. When I manually deleted some of the libraries from the vendor directory my project failed to build. Instead it produced an error to say that a tmp path to one of the files could not be found: (ENOENT: no such file or directory, open ‘/tmp/broccoli-24367twfkULfXNr4y/out-438-broccoli_debug_debug_2_vendor_js/vendor/jquery-ui/ui/minified/jquery-ui.min.js’

This error only cleared when I replaced the deleted file - is there a more graceful way I should be removing these libraries?

Note that the above is from building with ‘ember s’ not in an ember build. Is there something fundamental I’m not understanding?


  1. I think ember-cli uses vendor as a convention but shouldn’t automatically import things unless you call app.import(verified this is the case with ember-cli@3.2.0). I think you have to restart the ember s command entirely to see the changes reflected in the vendor.js. I would also make sure that is not being cached when you load the app in your browser. This is an example of doing so in Chrome’s developer tools:
  2. I’ve seen that error before when switching branches in my projects that have different packages installed in node_modules. Restarting ember s with my terminal has always resolved it for me.

I think ember serve calls ember build too. I don’t think your misunderstanding this; just seems to be some file adding / excluding oddities that you may notice sometimes when using ember-cli.

Have you tried cleaning up your development environment? I suspect that shutting down the development server, removing and reinstalling dependencies, and deleting your /tmp and /dist folders would likely clean up the unexpected behavior.

I use a couple of aliases that take care of these jobs:

alias nombom="rm -rf node_modules && rm -rf bower_components && npm i && bower i"
alias ep="nombom && rm -rf dist tmp"

In your case I would quit the server, run ep, and then restart the server.