Skip to content

license-webpack-plugin 3.0.0 causes prod builds to fail #22153

@Cephyric-gh

Description

@Cephyric-gh

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Possibly. It didn't exist in angular 11 (which is what I upgraded from), but cannot say if it was a thing in 12 or not.

Description

In angular 13 when I try and build prod (ng build project --configuration production) it fails because it cannot find the module webpack-sources. This is caused by license-webpack-plugin, and has been fixed in 4.0.0 (xz64/license-webpack-plugin#107), which fixed the issue for my project after I manually installed 4.0.0 as a devDependency of the project

🔬 Minimal Reproduction

Annoyingly it seems to not happen all the time, as I tried a fresh install (with all the same deps as my existing project) and the default angular project seemed to work.

🔥 Exception or Error


An unhandled exception occurred: Cannot find module 'webpack-sources'
Require stack:
- /folder/path/node_modules/license-webpack-plugin/dist/WebpackAssetManager.js
- /folder/path/node_modules/license-webpack-plugin/dist/LicenseWebpackPlugin.js
- /folder/path/node_modules/license-webpack-plugin/dist/index.js
- /folder/path/node_modules/@angular-devkit/build-angular/src/webpack/configs/common.js
- /folder/path/node_modules/@angular-devkit/build-angular/src/webpack/configs/index.js
- /folder/path/node_modules/@angular-devkit/build-angular/src/builders/browser/index.js
- /folder/path/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
- /folder/path/node_modules/@angular-devkit/architect/node/index.js
- /folder/path/node_modules/@angular/cli/models/architect-command.js
- /folder/path/node_modules/@angular/cli/commands/build-impl.js
- /folder/path/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /folder/path/node_modules/@angular-devkit/schematics/tools/index.js
- /folder/path/node_modules/@angular/cli/utilities/json-schema.js
- /folder/path/node_modules/@angular/cli/models/command-runner.js
- /folder/path/node_modules/@angular/cli/lib/cli/index.js
- /folder/path/node_modules/@angular/cli/lib/init.js
See "/private/var/folders/ll/v61c3w290mbdnsykh39v8h080000gn/T/ng-TVWIIk/angular-errors.log" for further details.

🌍 Your Environment


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 13.0.2
Node: 16.13.0
Package Manager: npm 8.1.0
OS: darwin x64

Angular: 13.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, localize, material
... material-moment-adapter, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.2
@angular-devkit/build-angular   13.0.2
@angular-devkit/core            13.0.2
@angular-devkit/schematics      13.0.2
@angular/cli                    13.0.2
@angular/youtube-player         12.2.12
@schematics/angular             13.0.2
ng-packagr                      13.0.3
rxjs                            7.4.0
typescript                      4.4.4

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions