How do I get angular 2 cli to copy css and other necessary files to dist folder

By : Nikolaj

I have set up an angular 2 typescript solution and added the material angular 2 npm package.

npm install -g angular-cli
ng build

Everything is nicely copied from my scaffolded source folder to a dist folder.

Then I add the angular 2 material npm package:

npm install ng2-material --save

But what do I do from here? How do I tell the build command to copy the necessary files from node_modules to the dist folder.

And where is the magic located that makes sure that these files get copied to the dist/vendor folder?


  <script src="vendor/es6-shim/es6-shim.js"></script>
  <script src="vendor/systemjs/dist/system-polyfills.js"></script>
  <script src="vendor/angular2/bundles/angular2-polyfills.js"></script>
  <script src="vendor/systemjs/dist/system.src.js"></script>
  <script src="vendor/rxjs/bundles/Rx.js"></script>

  <script src="vendor/angular2/bundles/"></script>
  <script src="vendor/angular2/bundles/"></script>
  <script src="vendor/angular2/bundles/"></script>

My package file ends up looking like this:

I hope my confusion comes from a lack of knowledge about npm. And not angular cli. (Because more people will be able to help me). But I haven't got a whole lot of experience in either.


I did like this:

module.exports = function (defaults) {
  var app = new Angular2App(defaults, {
      vendorNpmFiles: [
  return app.toTree();

Now my files are copied. Still don't understand how the other files in the dist-folder gets copied. The vendorNpmFiles array was empty.

By : Nikolaj

You don't need node_modules/ prefix, vendorNpmFiles automatically search in node_modules

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
By : Antoine

This video can help you solving your question :)
By: admin