Skip to content

Upgrade to webpack 5.112 and Angular CLI 20.3.41 by disabling emitDecoratorMetadata - #6549

Open
bram-atmire wants to merge 2 commits into
DSpace:mainfrom
bram-atmire:webpack-5.112-angular-20.3.41
Open

bram-atmire wants to merge 2 commits into
DSpace:mainfrom
bram-atmire:webpack-5.112-angular-20.3.41

Conversation

@bram-atmire

@bram-atmire bram-atmire commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

References

TL;DR

Needed to get us back on the latest webpack version.

Description

Since webpack 5.112, the Dependabot updates for webpack and for the Angular CLI build packages fail the build on every branch. This PR updates both together, disables emitDecoratorMetadata, and registers three REST models that this exposed as missing.

Instructions for Reviewers

Why the Dependabot PRs fail

Why emitDecoratorMetadata can be disabled

Nothing reads the design:* metadata: no code in src/, not @4science_ng-dynamic-forms/core (it uses its own metadata keys), and not Angular in AOT builds. The unit tests (JIT) pass. Angular CLI 20 no longer sets it for new projects.

The setting did have a hidden effect: modules imported only as types were still loaded. MetadataSecurityConfiguration is a @typedObject that is only imported as a type and was missing from the models list in provide-core.ts. Without the setting it was never registered, and the submission form fields were not rendered (5 failing e2e tests in the first CI run). EditItem and EditItemMode were also missing from that list. All three are now added.

List of changes in this PR:

How to test

  1. npm ci and npm run build:prod: no was not found or getLocation errors.
  2. npm run lint, npm run test:headless and the e2e tests pass. Locally, use TSESTREE_SINGLE_RUN=true for lint: outside CI, typescript-eslint uses watch programs and needs more than 4 GB.
  3. Optionally, start a new submission and check that the form fields are shown.

AI Disclosure (REQUIRED)

Were AI tools used in the creation of this PR?

  • No (This PR does NOT include AI-generated or AI-assisted content that requires disclosure.)
  • Yes (This PR includes AI-generated or AI-assisted content that requires disclosure.)

Claude Code (claude-opus-5-5) found the causes, made the changes and regenerated the lockfile. It ran build, lint, check-circ-deps and the unit tests locally (6015/6015), checked that all changed package versions are at least 14 days old without install scripts, and found the missing models by comparing production bundles (ng build --stats-json) after the first CI run failed. The e2e tests were only run in CI. I reviewed the change and this description.

Personally this is quite far from my own knowledge and comfort zone, but I was not able to detect any problems/conflicts with this, and I can't think of another approach to fix the Dependabot/Webpack/Angular upgrade path issues.

Checklist

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR follows all coding best practices based on the Code Conventions Guide
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

Bump @angular/ssr and @angular-devkit/build-angular to 20.3.41 together
with webpack 5.112.2. build-angular 20.3.40 pins webpack 5.105.0 and
imports webpack/lib files that webpack 5.112 moved, so the webpack
update cannot be applied on its own.

Disable emitDecoratorMetadata in tsconfig.json. With it enabled,
@ngtools/webpack keeps imports that are only used as types (for example
SimpleChanges), and webpack 5.112 now reports those missing exports as
build errors. Nothing in the application reads the decorator metadata.

Assisted-by: Claude Code [claude-opus-5-5]
@bram-atmire
bram-atmire force-pushed the webpack-5.112-angular-20.3.41 branch from a783e31 to 96f1e70 Compare November 22, 2026 09:42
These @typedObject classes were missing from the models list in
provide-core.ts. MetadataSecurityConfiguration is only imported as a
type, so it was only loaded (and registered) because
emitDecoratorMetadata kept type-only imports. With that setting
disabled, its module is dropped from the bundle, the metadata security
configuration cannot be deserialized, and the submission form fields
are never rendered. EditItem and EditItemMode are added for the same
reason, although they are currently still loaded through value imports.

Assisted-by: Claude Code [claude-opus-5-5]
@lgeggleston lgeggleston added dependencies Pull requests that update a dependency file code task labels Nov 24, 2026
@lgeggleston lgeggleston moved this to 🙋 Needs Reviewers Assigned in DSpace 11.0 Release Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code task dependencies Pull requests that update a dependency file

Projects

Status: 🙋 Needs Reviewers Assigned

Development

Successfully merging this pull request may close these issues.

2 participants