What will be done with the packages in node_module during deployment?

Maybe it’s a silly question, but I’m new to web front-end and the deployment procedure really confused me a lot.

After some search I found out that broccoli does the bower package asset pipeline work, I wanna know how and by whom npm packages are compiled into vendor.js ?

Further more, if I don`t want some npm packages to be compiled in production environment , what should I do?

Thanks a lot !

Most npm packages are not compiled into vendor.js by default.

Basically all the npm modules are loaded on the ‘build’ scripts (like ember serve, ember test and ember build). When the ember-addons are loaded IF they add assets to the browser they modify the broccoli/bower tree if they are adding some JS libraries.

If you don’t want that be added the only solution I’ve got is to NOT include them in your package.json.

An example of an addon that adds JS is ember-cli-moment-shim (you can look at their index.js for more information, but looks kind of complex)

From my humble understanding the vanilla project generated shouldn’t be adding so many dependencies on vendor.js but something like:

  • some startup/loader code
  • jquery (2.2.4)
  • ember (2.6.3)

Knowing that Ember addon will modify broccoli tree is really helpful, I will search for more articles about Ember addon, thank you!

Some npm packages are ember addons and some others don’t. Usually the ember add-ons names start with ember or ember-cli.

What they all have different (to simple npm packages) is that they have the keyword ember-addon on their package.json

I added some npm packages which are not ember addons, to make them importable in code I also installed ember-browserify.

I guess the ember-browserify does something magic to import all of these packages into vendor.js, is that right?

Right! I think you’re on the right track!