Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): never split polyfill chunks
Browse files Browse the repository at this point in the history
Fix #14280
  • Loading branch information
filipesilva authored and alexeagle committed May 7, 2019
1 parent ad34de2 commit fd0c868
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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));
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';


/**
Expand Down Expand Up @@ -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: {
Expand All @@ -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));
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,7 @@ export function getEsVersionForFileName(
return scriptTargetOverride && esVersionInFileName ?
'-' + ScriptTarget[scriptTargetOverride].toLowerCase() : '';
}

export function isPolyfillsEntry(name: string) {
return name === 'polyfills' || name === 'polyfills-es5';
}

0 comments on commit fd0c868

Please sign in to comment.