Skip to content

Commit 1d67497

Browse files
committed
fix(polyfills): move polyfills to scripts array
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
1 parent 2a513ca commit 1d67497

File tree

7 files changed

+11
-29
lines changed

7 files changed

+11
-29
lines changed

packages/angular-cli/blueprints/ng2/files/__path__/main.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import './polyfills.ts';
2-
31
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
42
import { enableProdMode } from '@angular/core';
53
import { environment } from './environments/environment';

packages/angular-cli/blueprints/ng2/files/__path__/polyfills.ts

-19
This file was deleted.

packages/angular-cli/blueprints/ng2/files/__path__/test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import './polyfills.ts';
2-
31
import 'zone.js/dist/long-stack-trace-zone';
42
import 'zone.js/dist/proxy.js';
53
import 'zone.js/dist/sync-test';

packages/angular-cli/blueprints/ng2/files/angular-cli.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
"styles": [
2121
"styles.<%= styleExt %>"
2222
],
23-
"scripts": [],
23+
"scripts": [
24+
"<%= relativeRootPath %>/node_modules/core-js/client/shim.min.js",
25+
"<%= relativeRootPath %>/node_modules/zone.js/dist/zone.js"
26+
],
2427
"environments": {
2528
"source": "environments/environment.ts",
2629
"dev": "environments/environment.ts",

tests/e2e/tests/build/scripts-array.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ export default function () {
1818
})
1919
.then(() => updateJsonFile('angular-cli.json', configJson => {
2020
const app = configJson['apps'][0];
21-
app['scripts'] = [
21+
app['scripts'] = app['scripts'].concat([
2222
'string-script.js',
2323
{ input: 'input-script.js' },
2424
{ input: 'lazy-script.js', lazy: true },
2525
{ input: 'pre-rename-script.js', output: 'renamed-script' },
2626
{ input: 'pre-rename-lazy-script.js', output: 'renamed-lazy-script', lazy: true },
2727
{ input: 'common-entry-script.js', output: 'common-entry' }
28-
];
28+
]);
2929
app['styles'] = [{ input: 'common-entry-style.css', output: 'common-entry' }];
3030
}))
3131
.then(() => ng('build'))

tests/e2e/tests/build/styles/styles-array.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export default function () {
2828
{ input: 'pre-rename-lazy-style.css', output: 'renamed-lazy-style', lazy: true },
2929
{ input: 'common-entry-style.css', output: 'common-entry' }
3030
];
31-
app['scripts'] = [{ input: 'common-entry-script.js', output: 'common-entry' }];
31+
app['scripts'] = app['scripts'].concat(
32+
[{ input: 'common-entry-script.js', output: 'common-entry' }]
33+
);
3234
}))
3335
.then(() => ng('build'))
3436
// files were created successfully

tests/e2e/tests/test/test-scripts.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ export default function () {
6060
.then(() => expectToFail(() => ng('test', '--single-run')))
6161
.then(() => updateJsonFile('angular-cli.json', configJson => {
6262
const app = configJson['apps'][0];
63-
app['scripts'] = [
63+
app['scripts'] = app['scripts'].concat([
6464
'string-script.js',
6565
{ input: 'input-script.js' }
66-
];
66+
]);
6767
}))
6868
// should pass now
6969
.then(() => ng('test', '--single-run'));

0 commit comments

Comments
 (0)