Skip to content

Fixes #39966 - Stop webpack console errors from shared modules - #11357

Open
tlabaj wants to merge 1 commit into
theforeman:developfrom
tlabaj:SAT-37376-shared-module-warnings
Open

tlabaj wants to merge 1 commit into
theforeman:developfrom
tlabaj:SAT-37376-shared-module-warnings

Conversation

@tlabaj

@tlabaj tlabaj commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Stop sharing uuid, yup, and reselect in the webpack module-federation scope so nested copies (uuid 8.3.2, yup 0.32.11, reselect 4.1.8) are no longer published as singletons and the Hosts page no longer logs unsatisfied-version warnings. SAT-37376
  • Allow data: in the Content-Security-Policy media-src directive, matching the existing img_src exception.
  • Emit production source maps with hidden-source-map so plugin remoteEntry.js files do not reference .map URLs that snaps do not serve.

Test plan

  • Rebuild webpack and open Hosts → All Hosts with the browser console open. Confirm there are no Unsatisfied version warnings for uuid, yup, reselect, or react-bootstrap.
  • Confirm the same page does not log a media-src Content-Security-Policy violation for a data: URL.
  • Build with NODE_ENV=production and confirm *_remoteEntry.js has no sourceMappingURL comment and devtools does not 404 on *_remoteEntry.js.map.
  • Load a Scalprum plugin (Katello or Ansible) and a page that uses Reselect selectors.
  • A missing GET /api/v2/users/:id/table_preferences/hosts can still return 404 when that user has no saved columns.

@tlabaj
tlabaj marked this pull request as draft October 28, 2026 12:09
@tlabaj
tlabaj force-pushed the SAT-37376-shared-module-warnings branch from 34746f3 to f1239d0 Compare October 28, 2026 13:59
@tlabaj
tlabaj marked this pull request as ready for review October 28, 2026 14:18

@kmalyjur kmalyjur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that, it works well, but I'm not 100% sure that it's not breaking anything, so I would appreciate a re-review from someone else.

Comment thread config/webpack.config.js
const allDependencies = { ...dependencies, ...devDependencies };
// Nested copies of these (uuid 8, yup 0.32, reselect 4) get registered beside
// the top-level packages. Singleton then picks the higher version and warns.
const unsharedDependencies = new Set(['uuid', 'yup', 'reselect']);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't seen the react-bootstrap warning yet, but shouldn't it be in this set too in order to disappear?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kmalyjur react-bootstrap does not need to be in this set. shared() only registers dependencies from Foreman's package.json, and react-bootstrap was removed there in #10624. The old warning was 0.33.1 required ~0.32.0, which is how webpack prints that old ^0.32.0 range against the hoisted 0.33.1 copy. Nothing registers it now, so the warning is already gone. Katello still depends on ^0.32.1, but plugin builds consume this same Foreman share map and do not publish their own copy.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thank you very much for the explanation

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants