hawtio / hawtio-online

Hawtio on Kubernetes/OpenShift
Apache License 2.0
23 stars 25 forks source link

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

Closed phantomjinx closed 6 months ago

phantomjinx commented 6 months ago
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 commented 6 months ago

@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:

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 commented 6 months ago

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: https://github.com/hawtio/hawtio/commit/aa29d5eb5d6f479ffb5183bb8d66c2c221e0d14b

tadayosi commented 6 months ago

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 commented 6 months ago

1.0.7 released: https://github.com/hawtio/hawtio-next/releases/tag/v1.0.7

phantomjinx commented 6 months ago

PR for 1.0.7 -> https://github.com/hawtio/hawtio-online/pull/347