Skip to content

Commit b3086ff

Browse files
alan-agius4vikerman
authored andcommitted
fix(@angular-devkit/build-angular): only copy assets outside of webpack when differential loading is needed in build builder
Fixes angular#15825
1 parent 5d9b20b commit b3086ff

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ const ProgressPlugin = require('webpack/lib/ProgressPlugin');
4040
const CircularDependencyPlugin = require('circular-dependency-plugin');
4141
const TerserPlugin = require('terser-webpack-plugin');
4242

43-
// tslint:disable-next-line:no-any
44-
const g: any = typeof global !== 'undefined' ? global : {};
4543

4644
// tslint:disable-next-line:no-big-function
4745
export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
@@ -242,10 +240,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
242240
}
243241

244242
// process asset entries
245-
if (
246-
buildOptions.assets &&
247-
(fullDifferential || buildOptions.watch || !differentialLoadingNeeded)
248-
) {
243+
if (buildOptions.assets.length) {
249244
const copyWebpackPluginPatterns = buildOptions.assets.map((asset: AssetPatternClass) => {
250245
// Resolve input paths relative to workspace root and add slash at the end.
251246
asset.input = path.resolve(root, asset.input).replace(/\\/g, '/');

packages/angular_devkit/build_angular/src/browser/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,14 @@ import {
1313
runWebpack,
1414
} from '@angular-devkit/build-webpack';
1515
import {
16-
getSystemPath,
1716
join,
1817
json,
1918
logging,
2019
normalize,
21-
resolve,
2220
tags,
2321
virtualFs,
2422
} from '@angular-devkit/core';
2523
import { NodeJsSyncHost } from '@angular-devkit/core/node';
26-
import { createHash } from 'crypto';
2724
import * as findCacheDirectory from 'find-cache-dir';
2825
import * as fs from 'fs';
2926
import * as path from 'path';
@@ -81,9 +78,7 @@ import {
8178
import { BundleActionExecutor } from './action-executor';
8279
import { Schema as BrowserBuilderSchema } from './schema';
8380

84-
const cacache = require('cacache');
8581
const cacheDownlevelPath = findCacheDirectory({ name: 'angular-build-dl' });
86-
const packageVersion = require('../../package.json').version;
8782

8883
export type BrowserBuilderOutput = json.JsonObject &
8984
BuilderOutput & {

packages/angular_devkit/build_angular/src/utils/webpack-browser-config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ export async function generateWebpackConfig(
106106
} else if (differentialLoading && !fullDifferential) {
107107
buildOptions = {
108108
...options,
109+
// Under downlevel differential loading we copy the assets outside of webpack.
110+
assets: [],
109111
esVersionInFileName: true,
110112
scriptTargetOverride: ts.ScriptTarget.ES5,
111113
es5BrowserSupport: undefined,

0 commit comments

Comments
 (0)