Angular-cli: Configure scripts.polyfills of build process

Created on 14 Jul 2016  路  3Comments  路  Source: angular/angular-cli

Please provide us with the following information:

  1. OS? Windows 7
  2. Versions:
    angular-cli: 1.0.0-beta.9
    node: 6.2.0
    os: win32 x64

I like to replace es6-shim with the core-js lib but when I run ng build or ng serve angular-cli always inject es6-shim instead of core-js.

Where can I configure the scripts which are masked behind {{#each scripts.polyfills}}?

A documentation of how to configure angular-cli is needed.

RFC / discussion / question

Most helpful comment

In the angular-cli-build.js file, add another array named polyfills after the vendorNpmFiles array, as in the example below. You need to make sure you include the default values in the array. I am using it because I have not had success in loading third party js libraries that are not written as a commonjs or systemjs module.

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      'systemjs/dist/system-polyfills.js',
      'systemjs/dist/system.src.js',
...
      'alertify/lib/alertify.min.js',
    ],
    polyfills: [
      'vendor/es6-shim/es6-shim.js',
      'vendor/reflect-metadata/Reflect.js',
      'vendor/systemjs/dist/system.src.js',
      'vendor/zone.js/dist/zone.js',
      'vendor/alertify/lib/alertify.min.js',
    ]
  });
};

All 3 comments

In the angular-cli-build.js file, add another array named polyfills after the vendorNpmFiles array, as in the example below. You need to make sure you include the default values in the array. I am using it because I have not had success in loading third party js libraries that are not written as a commonjs or systemjs module.

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      'systemjs/dist/system-polyfills.js',
      'systemjs/dist/system.src.js',
...
      'alertify/lib/alertify.min.js',
    ],
    polyfills: [
      'vendor/es6-shim/es6-shim.js',
      'vendor/reflect-metadata/Reflect.js',
      'vendor/systemjs/dist/system.src.js',
      'vendor/zone.js/dist/zone.js',
      'vendor/alertify/lib/alertify.min.js',
    ]
  });
};

Closed as issue was made obsolete by #1455.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings