fix(@angular-devkit/build-angular): never split polyfill chunks

Fix #14280
This commit is contained in:
Filipe Silva 2019-05-03 15:49:57 +01:00 committed by Alex Eagle
parent a41c185713
commit 888145e5a1
3 changed files with 9 additions and 5 deletions

View File

@ -11,7 +11,7 @@ import * as webpack from 'webpack';
import { IndexHtmlWebpackPlugin } from '../../plugins/index-html-webpack-plugin';
import { generateEntryPoints } from '../../utilities/package-chunk-sort';
import { WebpackConfigOptions } from '../build-options';
import { getSourceMapDevTool, normalizeExtraEntryPoints } from './utils';
import { getSourceMapDevTool, isPolyfillsEntry, normalizeExtraEntryPoints } from './utils';
const SubresourceIntegrityPlugin = require('webpack-subresource-integrity');
@ -114,7 +114,7 @@ export function getBrowserConfig(wco: WebpackConfigOptions): webpack.Configurati
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
return /[\\/]node_modules[\\/]/.test(moduleName)
&& !chunks.some(({ name }) => name === 'polyfills' || name === 'polyfills-es5'
&& !chunks.some(({ name }) => isPolyfillsEntry(name)
|| globalStylesBundleNames.includes(name));
},
},

View File

@ -10,7 +10,7 @@ import * as glob from 'glob';
import * as path from 'path';
import * as webpack from 'webpack';
import { WebpackConfigOptions, WebpackTestOptions } from '../build-options';
import { getSourceMapDevTool } from './utils';
import { getSourceMapDevTool, isPolyfillsEntry } from './utils';
/**
@ -85,7 +85,7 @@ export function getTestConfig(
plugins: extraPlugins,
optimization: {
splitChunks: {
chunks: ((chunk: { name: string }) => chunk.name !== 'polyfills'),
chunks: ((chunk: { name: string }) => !isPolyfillsEntry(chunk.name)),
cacheGroups: {
vendors: false,
vendor: {
@ -95,7 +95,7 @@ export function getTestConfig(
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
return /[\\/]node_modules[\\/]/.test(moduleName)
&& !chunks.some(({ name }) => name === 'polyfills');
&& !chunks.some(({ name }) => isPolyfillsEntry(name));
},
},
},

View File

@ -101,3 +101,7 @@ export function getEsVersionForFileName(
return scriptTargetOverride && esVersionInFileName ?
'-' + ScriptTarget[scriptTargetOverride].toLowerCase() : '';
}
export function isPolyfillsEntry(name: string) {
return name === 'polyfills' || name === 'polyfills-es5';
}