mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-20 05:24:57 +08:00
fix(@angular-devkit/build-angular): never split polyfill chunks
Fix #14280
This commit is contained in:
parent
a41c185713
commit
888145e5a1
@ -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));
|
||||
},
|
||||
},
|
||||
|
@ -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));
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -101,3 +101,7 @@ export function getEsVersionForFileName(
|
||||
return scriptTargetOverride && esVersionInFileName ?
|
||||
'-' + ScriptTarget[scriptTargetOverride].toLowerCase() : '';
|
||||
}
|
||||
|
||||
export function isPolyfillsEntry(name: string) {
|
||||
return name === 'polyfills' || name === 'polyfills-es5';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user