feat(@angular-devkit/build-angular): change es5BrowserSupport output filename to polyfills.es5.js

Closes #13808
This commit is contained in:
Charles Lyding 2019-03-03 14:35:04 -05:00 committed by Hans
parent b80a281342
commit 2f4602db08
9 changed files with 17 additions and 17 deletions

View File

@ -44,7 +44,7 @@ export function getBrowserConfig(wco: WebpackConfigOptions) {
entrypoints: generateEntryPoints(buildOptions), entrypoints: generateEntryPoints(buildOptions),
deployUrl: buildOptions.deployUrl, deployUrl: buildOptions.deployUrl,
sri: buildOptions.subresourceIntegrity, sri: buildOptions.subresourceIntegrity,
noModuleEntrypoints: ['es2015-polyfills'], noModuleEntrypoints: ['polyfills.es5'],
})); }));
} }
@ -113,7 +113,7 @@ export function getBrowserConfig(wco: WebpackConfigOptions) {
const moduleName = module.nameForCondition ? module.nameForCondition() : ''; const moduleName = module.nameForCondition ? module.nameForCondition() : '';
return /[\\/]node_modules[\\/]/.test(moduleName) return /[\\/]node_modules[\\/]/.test(moduleName)
&& !chunks.some(({ name }) => name === 'polyfills' || name === 'es2015-polyfills' && !chunks.some(({ name }) => name === 'polyfills' || name === 'polyfills.es5'
|| globalStylesBundleNames.includes(name)); || globalStylesBundleNames.includes(name));
}, },
}, },

View File

@ -54,7 +54,7 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
} }
if (buildOptions.es5BrowserSupport) { if (buildOptions.es5BrowserSupport) {
entryPoints['es2015-polyfills'] = [path.join(__dirname, '..', 'es2015-polyfills.js')]; entryPoints['polyfills.es5'] = [path.join(__dirname, '..', 'es2015-polyfills.js')];
} }
if (buildOptions.polyfills) { if (buildOptions.polyfills) {
@ -68,8 +68,8 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
]; ];
if (buildOptions.es5BrowserSupport) { if (buildOptions.es5BrowserSupport) {
entryPoints['es2015-polyfills'] = [ entryPoints['polyfills.es5'] = [
...entryPoints['es2015-polyfills'], ...entryPoints['polyfills.es5'],
path.join(__dirname, '..', 'es2015-jit-polyfills.js'), path.join(__dirname, '..', 'es2015-jit-polyfills.js'),
]; ];
} }

View File

@ -26,7 +26,7 @@ export function generateEntryPoints(
}; };
const entryPoints = [ const entryPoints = [
'es2015-polyfills', 'polyfills.es5',
'polyfills', 'polyfills',
'sw-register', 'sw-register',
...extraEntryPoints(appConfig.styles, 'styles'), ...extraEntryPoints(appConfig.styles, 'styles'),

View File

@ -54,7 +54,7 @@ export default function () {
// index.html lists the right bundles // index.html lists the right bundles
.then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim` .then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="es2015-polyfills.js" nomodule></script> <script src="polyfills.es5.js" nomodule></script>
<script src="polyfills.js"></script> <script src="polyfills.js"></script>
<script src="scripts.js"></script> <script src="scripts.js"></script>
<script src="renamed-script.js"></script> <script src="renamed-script.js"></script>

View File

@ -43,7 +43,7 @@ export default function () {
`)) `))
.then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim` .then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="es2015-polyfills.js" nomodule></script> <script src="polyfills.es5.js" nomodule></script>
<script src="polyfills.js"></script> <script src="polyfills.js"></script>
<script src="vendor.js"></script> <script src="vendor.js"></script>
<script src="main.js"></script> <script src="main.js"></script>

View File

@ -15,7 +15,7 @@ export default async function () {
await expectFileToMatch('dist/test-project/polyfills.js', 'zone.js'); await expectFileToMatch('dist/test-project/polyfills.js', 'zone.js');
expectFileToMatch('dist/test-project/index.html', oneLineTrim` expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="es2015-polyfills.js" nomodule></script> <script src="polyfills.es5.js" nomodule></script>
<script src="polyfills.js"></script> <script src="polyfills.js"></script>
`); `);
const jitPolyfillSize = await getFileSize('dist/test-project/polyfills.js'); const jitPolyfillSize = await getFileSize('dist/test-project/polyfills.js');
@ -28,7 +28,7 @@ export default async function () {
await expectFileToMatch('dist/test-project/polyfills.js', 'zone.js'); await expectFileToMatch('dist/test-project/polyfills.js', 'zone.js');
expectFileToMatch('dist/test-project/index.html', oneLineTrim` expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="es2015-polyfills.js" nomodule></script> <script src="polyfills.es5.js" nomodule></script>
<script src="polyfills.js"></script> <script src="polyfills.js"></script>
`); `);
} }

View File

@ -48,7 +48,7 @@ export default function () {
`))) `)))
.then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim` .then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="es2015-polyfills.js" nomodule></script> <script src="polyfills.es5.js" nomodule></script>
<script src="polyfills.js"></script> <script src="polyfills.js"></script>
<script src="vendor.js"></script> <script src="vendor.js"></script>
<script src="main.js"></script> <script src="main.js"></script>
@ -64,7 +64,7 @@ export default function () {
// index.html lists the right bundles // index.html lists the right bundles
.then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim` .then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="es2015-polyfills.js" nomodule></script> <script src="polyfills.es5.js" nomodule></script>
<script src="polyfills.js"></script> <script src="polyfills.js"></script>
<script src="styles.js"></script> <script src="styles.js"></script>
<script src="renamed-style.js"></script> <script src="renamed-style.js"></script>

View File

@ -10,7 +10,7 @@ export default async function () {
}); });
await ng('build'); await ng('build');
await expectFileNotToExist('dist/test-project/es2015-polyfills.js'); await expectFileNotToExist('dist/test-project/polyfills.es5.js');
await expectFileToMatch('dist/test-project/index.html', oneLineTrim` await expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="polyfills.js"></script> <script src="polyfills.js"></script>
@ -20,10 +20,10 @@ export default async function () {
`); `);
await ng('build', `--es5BrowserSupport`); await ng('build', `--es5BrowserSupport`);
await expectFileToMatch('dist/test-project/es2015-polyfills.js', 'core-js'); await expectFileToMatch('dist/test-project/polyfills.es5.js', 'core-js');
await expectFileToMatch('dist/test-project/index.html', oneLineTrim` await expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="es2015-polyfills.js" nomodule></script> <script src="polyfills.es5.js" nomodule></script>
<script src="polyfills.js"></script> <script src="polyfills.js"></script>
<script src="styles.js"></script> <script src="styles.js"></script>
<script src="vendor.js"></script> <script src="vendor.js"></script>

View File

@ -23,7 +23,7 @@ export default function() {
.then(() => expectFileToMatch('dist/test-project/styles.css', '* Bootstrap')) .then(() => expectFileToMatch('dist/test-project/styles.css', '* Bootstrap'))
.then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim` .then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="es2015-polyfills.js" nomodule></script> <script src="polyfills.es5.js" nomodule></script>
<script src="polyfills.js"></script> <script src="polyfills.js"></script>
<script src="scripts.js"></script> <script src="scripts.js"></script>
<script src="vendor.js"></script> <script src="vendor.js"></script>
@ -40,7 +40,7 @@ export default function() {
.then(() => expectFileToMatch('dist/test-project/styles.css', '* Bootstrap')) .then(() => expectFileToMatch('dist/test-project/styles.css', '* Bootstrap'))
.then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim` .then(() => expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script> <script src="runtime.js"></script>
<script src="es2015-polyfills.js" nomodule></script> <script src="polyfills.es5.js" nomodule></script>
<script src="polyfills.js"></script> <script src="polyfills.js"></script>
<script src="scripts.js"></script> <script src="scripts.js"></script>
<script src="main.js"></script> <script src="main.js"></script>