From a4d31fd16e6cd15caab34496d84a9fe2c8df49cb Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Tue, 13 Oct 2020 10:43:32 -0400 Subject: [PATCH] refactor(@angular-devkit/build-angular): fully temporarily disable Webpack 5 license extraction --- .../angular_devkit/build_angular/src/browser/index.ts | 10 ++++++++++ .../build_angular/src/webpack/configs/browser.ts | 10 ++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/browser/index.ts b/packages/angular_devkit/build_angular/src/browser/index.ts index b593f79c52..40e0c14ea0 100644 --- a/packages/angular_devkit/build_angular/src/browser/index.ts +++ b/packages/angular_devkit/build_angular/src/browser/index.ts @@ -54,6 +54,7 @@ import { getIndexInputFile, getIndexOutputFile, } from '../utils/webpack-browser-config'; +import { isWebpackFiveOrHigher } from '../utils/webpack-version'; import { getAotConfig, getBrowserConfig, @@ -176,6 +177,15 @@ async function initialize( // Assets are processed directly by the builder except when watching const adjustedOptions = options.watch ? options : { ...options, assets: [] }; + // TODO_WEBPACK_5: Investigate build/serve issues with the `license-webpack-plugin` package + if (adjustedOptions.extractLicenses && isWebpackFiveOrHigher()) { + adjustedOptions.extractLicenses = false; + context.logger.warn( + 'Warning: License extraction is currently disabled when using Webpack 5. ' + + 'This is temporary and will be corrected in a future update.', + ); + } + const { config, projectRoot, diff --git a/packages/angular_devkit/build_angular/src/webpack/configs/browser.ts b/packages/angular_devkit/build_angular/src/webpack/configs/browser.ts index 0711f78e50..30eeb245cf 100644 --- a/packages/angular_devkit/build_angular/src/webpack/configs/browser.ts +++ b/packages/angular_devkit/build_angular/src/webpack/configs/browser.ts @@ -7,7 +7,7 @@ */ import * as webpack from 'webpack'; import { WebpackConfigOptions } from '../../utils/build-options'; -import { isWebpackFiveOrHigher, withWebpackFourOrFive } from '../../utils/webpack-version'; +import { withWebpackFourOrFive } from '../../utils/webpack-version'; import { CommonJsUsageWarnPlugin } from '../plugins'; import { getSourceMapDevTool } from '../utils/helpers'; @@ -38,13 +38,7 @@ export function getBrowserConfig(wco: WebpackConfigOptions): webpack.Configurati })); } - // TODO_WEBPACK_5: Investigate build/serve issues with the `license-webpack-plugin` package - if (extractLicenses && isWebpackFiveOrHigher()) { - wco.logger.warn( - 'Warning: License extraction is currently disabled when using Webpack 5. ' + - 'This is temporary and will be corrected in a future update.', - ); - } else if (extractLicenses) { + if (extractLicenses) { const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin; extraPlugins.push(new LicenseWebpackPlugin({ stats: {