-
Notifications
You must be signed in to change notification settings - Fork 12k
Conditional ES5 Browser Polyfill Loading #13403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
397fe68
feat(@angular-devkit/build-angular): conditional ES2015 polyfill loading
clydin a667407
fix(@schematics/angular): remove redundant ES2015 polyfills
clydin 2955b7b
feat(@schematics/angular): enabled conditional ES2015 polyfills for n…
clydin f704ecb
test: update CLI E2E with additional script element
clydin dd4c381
test: additional tests for conditional ES2015 polyfills
clydin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/angular_devkit/build_angular/src/angular-cli-files/models/es2015-jit-polyfills.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import 'core-js/es6/reflect'; |
21 changes: 21 additions & 0 deletions
21
packages/angular_devkit/build_angular/src/angular-cli-files/models/es2015-polyfills.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import 'core-js/es6/symbol'; | ||
import 'core-js/es6/object'; | ||
import 'core-js/es6/function'; | ||
import 'core-js/es6/parse-int'; | ||
import 'core-js/es6/parse-float'; | ||
import 'core-js/es6/number'; | ||
import 'core-js/es6/math'; | ||
import 'core-js/es6/string'; | ||
import 'core-js/es6/date'; | ||
import 'core-js/es6/array'; | ||
import 'core-js/es6/regexp'; | ||
import 'core-js/es6/map'; | ||
import 'core-js/es6/weak-map'; | ||
import 'core-js/es6/set'; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { oneLineTrim } from 'common-tags'; | ||
import { expectFileNotToExist, expectFileToMatch } from '../../utils/fs'; | ||
import { ng } from '../../utils/process'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
|
||
export default async function () { | ||
await updateJsonFile('angular.json', workspaceJson => { | ||
const appArchitect = workspaceJson.projects['test-project'].architect; | ||
appArchitect.build.options.es5BrowserSupport = false; | ||
}); | ||
|
||
await ng('build'); | ||
await expectFileNotToExist('dist/test-project/es2015-polyfills.js'); | ||
await expectFileToMatch('dist/test-project/index.html', oneLineTrim` | ||
<script type="text/javascript" src="runtime.js"></script> | ||
<script type="text/javascript" src="polyfills.js"></script> | ||
<script type="text/javascript" src="styles.js"></script> | ||
<script type="text/javascript" src="vendor.js"></script> | ||
<script type="text/javascript" src="main.js"></script> | ||
`); | ||
|
||
await ng('build', `--es5BrowserSupport`); | ||
await expectFileToMatch('dist/test-project/es2015-polyfills.js', 'core-js'); | ||
await expectFileToMatch('dist/test-project/index.html', oneLineTrim` | ||
<script type="text/javascript" src="runtime.js"></script> | ||
<script type="text/javascript" src="es2015-polyfills.js" nomodule></script> | ||
<script type="text/javascript" src="polyfills.js"></script> | ||
<script type="text/javascript" src="styles.js"></script> | ||
<script type="text/javascript" src="vendor.js"></script> | ||
<script type="text/javascript" src="main.js"></script> | ||
`); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be mistaken, but it's my understanding that polyfills are moved into an internal file. I often find that I also need to import some of the es7 modules (for example to support
Object.entries
) into polifyls. Having them in an internal file won't allow me adding additional polifylls only required for legacy browsers. It'd be my preference if there was a new file generated by CLI and included in the app:polifyls.legacy.ts
or something like that.