-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error encountered when updating @angular-devkit/build-angular to Version 16.1.0 #25419
Comments
This comment was marked as spam.
This comment was marked as spam.
1 similar comment
This comment was marked as spam.
This comment was marked as spam.
I suspect that this is caused because the Can you confirm that your |
I can indeed verify that the index.html is valid. The only modification required is downgrading the version number to 16.0.0, after which it will function properly with the unchanged index.html. |
I can canfirm what @PascalSwissDev says. index.html is valid and if I reduce the index.html to only what it really needs the same error occurs. If i set inlinecritital to false or move back to 16.0.* everything is working again. But I have other projects with Angular 16.1 who are working without problems. So it seems to be a third-party-package that impacts the issue. |
Can you setup a minimal repro please? You can read here why this is needed. A good way to make a minimal repro is to create a new app via |
Could find it out. In my project where it is not working the npm package "domhandler" is installed with version 4.* and NOT 5.0 if I install "domhandler" with version 5 everything is working again. So a third party package installs an older version of domhandler while critters expects and needs version 5. |
@paulstelzer, is it a direct dependancy? |
"domhandler" was installed by a third party package, now I am installed it directly in my "devDependencies" |
Can you tell what dependancy? |
So is it something that should be updated by the angular team? |
|
In my case, I do have a build with "CommonJS or AMD dependencies". Maybe that is the source? |
In my case , I have validated that I am on a version of critters that is dependant on domhandler |
I would also like to point out that it does happen with webpack and esbuild but only in prod build. And I do not use critters at all. |
@Akxe I can confirm this as well happens with webpack and esbuild |
I was facing the same issue and deleting the node_modules folder & package-lock.json and reinstalling the dependencies fixed this issue for me |
For me removing the package-lock.json also resolved the issue. |
It may be caused because of NPM vs YARN. I use NPM. Use reactions to show what you use:
Deleting the |
Same issue here - the cause was also that domhandler 4.x was an additional dependency to domhandler 5.x. In my case this dependency was caused by @capacitor/* which I was using in version 4.x. Upgrading to 5.x fixed the problem |
Same problem here. It seems to be gone when
Full path: |
This worked for me. Thanks. |
I had the same problems, and changing the angular.json did not help in my case. As mentionned earlier by several people, I manually installed |
This worked for me. Thank you. |
…g for external stylesheets These changes revert the performance improvement from angular@e88aea6 and add a test. The problem with the previous approach is that it assumes that a `link` tag processed by Critters will be preceded by a `style` tag that was inserted by Critters. This assumption might not necessarily be true if Critters is unable to resolve the content of the linked styles. Furthermore, I'm not sure if we need to optimize this code path to begin with, because it only does a shallow traversal of the `head` tag which is generally fast and is unlikely to have many direct descendants. Fixes angular#25419.
…g for external stylesheets These changes revert the performance improvement from e88aea6 and add a test. The problem with the previous approach is that it assumes that a `link` tag processed by Critters will be preceded by a `style` tag that was inserted by Critters. This assumption might not necessarily be true if Critters is unable to resolve the content of the linked styles. Furthermore, I'm not sure if we need to optimize this code path to begin with, because it only does a shallow traversal of the `head` tag which is generally fast and is unlikely to have many direct descendants. Fixes #25419. (cherry picked from commit d6ae2c7)
…g for external stylesheets These changes revert the performance improvement from e88aea6 and add a test. The problem with the previous approach is that it assumes that a `link` tag processed by Critters will be preceded by a `style` tag that was inserted by Critters. This assumption might not necessarily be true if Critters is unable to resolve the content of the linked styles. Furthermore, I'm not sure if we need to optimize this code path to begin with, because it only does a shallow traversal of the `head` tag which is generally fast and is unlikely to have many direct descendants. Fixes #25419.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build
Is this a regression?
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
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: