Skip to content

L3 Workshop: Package the carddemo-web application

0

I'm currently encountering the below error while package the carddemo-web application

[ERROR] - Generating browser application bundles (phase: setup)... [ERROR] TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.io/guide/build#configuring-browser-compatibility [ERROR] NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning. [ERROR] √ Browser application bundle generation complete. [ERROR] √ Browser application bundle generation complete. [ERROR] - Copying assets... [ERROR] √ Copying assets complete. [ERROR] - Generating index html... [ERROR] - Generating index html... [ERROR] 2 rules skipped due to selector errors: [ERROR] .form-floating>~label -> Did not expect successive traversals. [ERROR] .form-floating>~label -> Did not expect successive traversals. [ERROR] √ Index html generation complete.

asked a year ago151 views

2 Answers
0

The error messages you're seeing during the packaging of the carddemo-web application in the AWS Blu Age L3 Workshop are mostly warnings rather than critical errors.

The main issues are:

  1. TypeScript compiler options warning: The Angular CLI is using "ES2022" for "target" and "false" for "useDefineForClassFields". This is a warning suggesting you could set the "target" to "ES2022" in the project's tsconfig to remove this warning.

  2. CSS selector errors: Two rules are being skipped due to selector errors with ".form-floating>~label" where it reports "Did not expect successive traversals."

Despite these warnings, the build process appears to be completing successfully as indicated by the "complete" messages for bundle generation, asset copying, and index html generation. These warnings shouldn't prevent the application from functioning correctly.

If you're concerned about these warnings, you could:

  1. Update the tsconfig.json file to set the "target" to "ES2022" to address the first warning.

  2. Review and fix the CSS selectors in your stylesheets that use ".form-floating>~label" to address the selector errors.

However, since these appear to be warnings rather than fatal errors, you should be able to proceed with the workshop without making these changes.
Sources
AWS Blu Age L3 Workshop - Error on Automation - Execute | AWS re:Post
AWS Blu Age L3 workshop -Automation Build Failed | AWS re:Post
AWS Blu Age Level 3 Self-Paced Troubleshooting Workshop > Automation > Execute > Run execute.xml Ant script | AWS re:Post

answered a year ago

AWS
SUPPORT ENGINEER

reviewed a year ago

0

This looks like an Angular build-time configuration mismatch rather than a packaging issue with the application itself. The key part of the message, where Angular CLI enforces "target": "ES2022" and "useDefineForClassFields": false, points to a shift in how modern Angular versions handle ECMAScript targets and browser compatibility. Essentially, the Angular team moved responsibility for ECMAScript targeting and polyfills out of tsconfig.json and into browserslist, so that the build pipeline aligns automatically with supported browser standards.

Here’s how I’d approach it:

Check Angular and CLI versions Make sure your local Angular CLI and global Angular DevKit packages are in sync with your project version. A mismatch between CLI and project versions can trigger warnings or incorrect assumptions about the target value in tsconfig.json.

Align TypeScript settings In your tsconfig.json, explicitly set "target": "ES2022" and "useDefineForClassFields": false. This ensures the compiler behaves consistently with Angular’s build pipeline. While you could override it, keeping these aligned avoids class field initialization issues across browsers.

Review your Browserslist configuration Open .browserslistrc (or browserslist in package.json) and confirm you’re targeting the right browsers. For example:

last 2 Chrome versions
last 2 Firefox versions
not IE 11

Angular uses this list to decide which ECMAScript features to transpile, so making it explicit helps avoid unpredictable build outputs.

Clean and rebuild Remove node_modules, clear your Angular cache (npx ng cache clean), reinstall dependencies, and rebuild.

rm -rf node_modules
npm install
npx ng build --configuration production

CSS Selector Warning The “successive traversals” issue in .form-floating>~label is caused by deprecated CSS selector patterns. These warnings don’t block the build, but updating to a simpler structure like .form-floating label can remove the noise and align your styles with Bootstrap 5+ best practices.

In essence, nothing is wrong with your codebase itself. The Angular build tools have simply evolved, and the configuration needs to catch up. Once you’ve synced your Angular, TypeScript, and Browserslist versions, your packaging process should run cleanly again.

If this project sits within a broader CI/CD or containerized deployment workflow, for example when building with AWS CodeBuild or deploying to Amplify or ECS, ensuring consistent Node.js and Angular CLI versions across build environments will save hours of troubleshooting down the line.

I’ve seen this same issue appear often during modernization work for client apps migrating from Angular 11 or 12 to the newer 16+ versions. If you’re working within that range, feel free to share your exact Angular and Node versions. I’d be happy to suggest the precise configuration combination that will make your pipeline run flawlessly.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.