Skip to content
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

Upgrade to hawtio 1.0.4 + causes compile / runtime errors #340

Closed
phantomjinx opened this issue Feb 20, 2024 · 5 comments
Closed

Upgrade to hawtio 1.0.4 + causes compile / runtime errors #340

phantomjinx opened this issue Feb 20, 2024 · 5 comments
Assignees
Milestone

Comments

@phantomjinx
Copy link
Member

WARNING in ../../node_modules/@hawtio/react/node_modules/@patternfly/react-charts/dist/esm/components/ChartCursorTooltip/ChartCursorFlyout.js 87:62-88
export 'CommonProps' (imported as 'CommonProps') was not found in 'victory-core' (possible exports: Arc, Axis, Background, Border, Box, Circle, ClipPath, Collection, Data, DefaultTransitions, Domain, Events, Helpers, Hooks, Immutable, LabelHelpers, Line, LineHelpers, LineSegment, Log, Path, Point, PointPathHelpers, Portal, PortalContext, Rect, Scale, Selection, Style, TSpan, Text, TextSize, Timer, TimerContext, Transitions, UserProps, VictoryAccessibleGroup, VictoryAnimation, VictoryClipContainer, VictoryContainer, VictoryLabel, VictoryPortal, VictoryTheme, VictoryTransition, Whisker, Wrapper, addEvents)
 @ ../../node_modules/@hawtio/react/node_modules/@patternfly/react-charts/dist/esm/components/ChartCursorTooltip/index.js 1:0-36 1:0-36
 @ ../../node_modules/@hawtio/react/node_modules/@patternfly/react-charts/dist/esm/components/index.js 9:0-37 9:0-37
 @ ../../node_modules/@hawtio/react/node_modules/@patternfly/react-charts/dist/esm/index.js 1:0-29 1:0-29
 @ ../../node_modules/@hawtio/react/dist/index.js 3624:26-61 15760:27-62 16742:27-62
 @ consume shared module (default) @hawtio/react@^1.0.4 (singleton) (fallback: ../../node_modules/@hawtio/react/dist/index.js)
 @ ./src/bootstrap.tsx 2:0-62 9:0-15 9:16-28 10:32-47 13:4-32 18:0-16
 @ ./src/index.ts 3:0-21

WARNING in ../../node_modules/@hawtio/react/node_modules/@module-federation/utilities/dist/index.cjs.js 862:122-132
Critical dependency: the request of a dependency is an expression
 @ ../../node_modules/@hawtio/react/dist/index.js 607:23-62
 @ consume shared module (default) @hawtio/react@^1.0.4 (singleton) (fallback: ../../node_modules/@hawtio/react/dist/index.js)
 @ ./src/bootstrap.tsx 2:0-62 9:0-15 9:16-28 10:32-47 13:4-32 18:0-16
 @ ./src/index.ts 3:0-21

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.90.3 compiled with 2 warnings in 25943 ms

After upgrade to 1.0.4 (or 1.0.5 or 1.0.6), these errors are presented when starting the dev-server.

@phantomjinx phantomjinx self-assigned this Feb 20, 2024
@phantomjinx phantomjinx added this to the 2024Q1 milestone Feb 20, 2024
@phantomjinx
Copy link
Member Author

@tadayosi
Would appreciate your thoughts on this...

Initially, thought it must be the dependency upgrades I merged in, yesterday, but taking out a branch and going back to prior to the upgrades, these errors pop up the moment that I upgrade @hawtio/react to version 1.0.4.

I have some kind of fix / workaround for the react-charts error:

  • It appears that @hawtio/react 1.0.4+ uses 2 different versions of the victory-... dependencies, eg. victory-core.
    • Imports 36.9.1 to node-modules
    • Imports 36.8.6 to `node-modules/@patternfly/react-charts/node-modules/victory-core
  • However, the build version of @hawtio/react 1.0.4+ only requires 36.9.1 so when consuming react-charts as a 3rd-party dependency in hawtio-online, it tries to consume 36.9.1 and the API has obviously changed between the two versions, generating the first error.
  • Was able to workaround the compile error by including the following in package.json (obviously not an ideal solution):
    "@patternfly/react-charts": "6.94.21",
    "victory-area": "36.8.6",
    "victory-axis": "36.8.6",
    "victory-bar": "36.8.6",
    "victory-chart": "36.8.6",
    "victory-core": "36.8.6",
    "victory-create-container": "36.8.6",
    "victory-cursor-container": "36.8.6",
    "victory-group": "36.8.6",
    "victory-legend": "36.8.6",
    "victory-line": "36.8.6",
    "victory-pie": "36.8.6",
    "victory-scatter": "36.8.6",
    "victory-stack": "36.8.6",
    "victory-tooltip": "36.8.6",
    "victory-voronoi-container": "36.8.6",
    "victory-zoom-container": "36.8.6",

The second error is more of a problem and frankly I am stumped. It appears that the upgrade of @module-federation/utilties from 3.0.0 (or possibly 3.0.2 as it is mentioned in yarn.lock) to 3.0.5 has introduced a dynamic loading at line (node_modules/@hawtio/react/node_modules/@module-federation/utilities/dist/index.cjs.js 862:122-132) which webpack just does not like:

(function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(/        * webpackIgnore: true */ url)

Have tried a couple of things like defining the mf/utilities version in hawtio-online and trying to ignore the library in the webpack config but nothing has worked. So am just not sure how to proceed with this so please any suggestions would appreciated.

@tadayosi
Copy link
Member

Yeah they are all known issues.

For react-charts, it's the issue with react-charts where it only specifies ^36.6.7 as the victory-core version, so the semver by yarn tries to upgrade it to the latest one 36.9.x which has some breaking changes. So the solution is easy, you can just set resolution of victory-core to 36.8.6 by running the yarn command:

yarn set resolution victory-core@npm:^36.6.7 npm:36.8.6

Note only victory-core needs to be fixed. The other victory libs are fine to upgrade to latest.

Next, for the MF utilities, it's actually just a warning, so you can ignore it when running locally.

WARNING in ../../node_modules/@hawtio/react/node_modules/@module-federation/utilities/dist/index.cjs.js 862:122-132
Critical dependency: the request of a dependency is an expression

However, with CI=true a warning causes the CI to stop. So, to fix it, you can simply force ignoring it. You can check how hawtio/hawtio handles the exact issue:
hawtio/hawtio@aa29d5e

@tadayosi
Copy link
Member

Note the latest @hawtio/react is 1.0.6, and I'll soon release 1.0.7 which contains fixes requested from the Artemis team. So please upgrade it to the latest.

@tadayosi
Copy link
Member

phantomjinx added a commit to phantomjinx/hawtio-online that referenced this issue Feb 22, 2024
* Pin victory-core resolution to 36.8.6 to remove warning about react/charts

* management-service.ts
 * Fix casting compilation error

* Suppress Critical Dependency expression warning
phantomjinx added a commit to phantomjinx/hawtio-online that referenced this issue Feb 22, 2024
* Pin victory-core resolution to 36.8.6 to remove warning about react/charts

* management-service.ts
 * Fix casting compilation error

* Suppress Critical Dependency expression warning
@phantomjinx
Copy link
Member Author

PR for 1.0.7 -> #347

phantomjinx added a commit that referenced this issue Feb 23, 2024
* Pin victory-core resolution to 36.8.6 to remove warning about react/charts

* management-service.ts
 * Fix casting compilation error

* Suppress Critical Dependency expression warning
@lhein lhein moved this from New to Done in Kanban Board Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants