Skip to content

Angular 11 - webpack 5 support #19479

@AsmisAlan

Description

@AsmisAlan

🐞 bug report

Affected Package

@Angular-devkit

Description

Hello people! recently I have upgraded an application from angular 10 to angular 11 in order to try some features of webpack 5.
I completed the entire migration without adding webpack and all worked well, Then I added "resolutions":{"webpack": "^5.0.0"} in the package.json file as the documentation explain and the devkit package started to fail when I ran the build/serve command.

🔬 Minimal Reproduction

Upgrade from angular 10 to angular 11 using Webpack 5.

🔥 Exception or Error

(node:24880) UnhandledPromiseRejectionWarning: Error: NormalModuleFactory.beforeResolve is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created.
at C:....\node_modules@angular-devkit\build-angular\node_modules\webpack\lib\NormalModuleFactory.js:644:11
at eval (eval at create (C:....\node_modules@angular-devkit\build-angular\node_modules\tapable\lib\HookCodeFactory.js:33:10), :12:1)
(node:24880) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 25)
(node:24880) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:24880) UnhandledPromiseRejectionWarning: Error: NormalModuleFactory.beforeResolve is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created.
at C:....\node_modules@angular-devkit\build-angular\node_modules\webpack\lib\NormalModuleFactory.js:644:11
at eval (eval at create (C:...\node_modules@angular-devkit\build-angular\node_modules\tapable\lib\HookCodeFactory.js:33:10), :12:1)
(node:24880) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 26)
(node:24880) UnhandledPromiseRejectionWarning: Error: NormalModuleFactory.beforeResolve is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created.
at C:....\node_modules@angular-devkit\build-angular\node_modules\webpack\lib\NormalModuleFactory.js:644:11
at eval (eval at create (C:...\node_modules@angular-devkit\build-angular\node_modules\tapable\lib\HookCodeFactory.js:33:10), :12:1)
(node:24880) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 27)
(node:24880) UnhandledPromiseRejectionWarning: Error: NormalModuleFactory.beforeResolve is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created.
at C:....\node_modules@angular-devkit\build-angular\node_modules\webpack\lib\NormalModuleFactory.js:644:11
at eval (eval at create (C:......\node_modules@angular-devkit\build-angular\node_modules\tapable\lib\HookCodeFactory.js:33:10), :12:1)
(node:24880) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 28)

🌍 Your Environment

Angular Version:
Angular CLI: 11.0.2
Node: 12.18.3
OS: win32 x64
Angular: 11.0.2

@angular-devkit/architect 0.1000.8
@angular-devkit/build-angular 0.1100.2
@angular-devkit/core 11.0.2
@angular-devkit/schematics 10.0.8
@angular/cdk 11.0.1
@angular/flex-layout 11.0.0-beta.33
@angular/material 11.0.1
@schematics/angular 11.0.2
@schematics/update 0.1100.2
ng-packagr 11.0.3
rxjs 6.6.3
typescript 4.0.5
webpack 4.44.2

Anything else relevant?

Something strange that I noticed is that the Webpack 5 was installed but the angular version show that is using the version 4.44.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions