Skip to content

Error encountered when updating @angular-devkit/build-angular to Version 16.1.0 #25419

Closed

Description

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

16.0.0

Description

Upon updating @angular-devkit/build-angular to Version 16.1.0, an error occurs during index HTML generation. The specific error message is "document.documentElement.setAttribute is not a function."

Upon investigation, I have identified the root cause of the issue. It appears that enabling the optimization option, specifically setting inlineCritical to True under styles, triggers the error. However, if this option is disabled, the build process completes successfully.

Minimal Reproduction

Command used:
npx nx run project:build:production

Package use:
@angular-devkit/build-angular 16.1.0

Exception or Error

√ Browser application bundle generation complete.
√ Copying assets complete.
× Index html generation failed.
document.documentElement.setAttribute is not a function
 ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
 >  NX   Ran target build for project *projectname* (58s)
 
    ×    1/1 failed
    √    0/1 succeeded [0 read from cache]

Your Environment

Angular CLI: 16.1.0
Node: 18.10.0
Package Manager: npm 8.19.2
OS: win32 x64

Angular: 16.1.1
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1601.0
@angular-devkit/build-angular   16.1.0
@angular-devkit/core            16.1.0
@angular-devkit/schematics      16.1.0
@angular/cli                    16.1.0
@schematics/angular             16.1.0
rxjs                            7.8.1
typescript                      5.1.3

Anything else relevant?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions