faceyspacey/react-universal-component

Circular dependency warnings

daleyjem opened this issue · 7 comments

Getting some Webpack circular dependency warnings after a version upgrade from v2 to v4.

WARNING in Circular dependency detected:
node_modules/react-universal-component/dist/helpers.js -> node_modules/react-universal-component/dist/index.js -> node_modules/react-universal-component/dist/helpers.js

WARNING in Circular dependency detected:
node_modules/react-universal-component/dist/index.js -> node_modules/react-universal-component/dist/helpers.js -> node_modules/react-universal-component/dist/index.js

WARNING in Circular dependency detected:
node_modules/react-universal-component/dist/requireById/index.js -> node_modules/react-universal-component/dist/utils.js -> node_modules/react-universal-component/dist/requireById/index.js

WARNING in Circular dependency detected:
node_modules/react-universal-component/dist/utils.js -> node_modules/react-universal-component/dist/requireById/index.js -> node_modules/react-universal-component/dist/utils.js

Any plans for resolving these?

No current plans. I'm likely going to work with loadable component on any code splitting stuff. I'll put up a message about looking for maintainers for universal. With Module Federation, I no longer need HOCs and only need some of the chunk flushing mechanism. The rest I can bake into the webpack runtime directly.

I believe the whole code split product line - from loadable, universal, react loadable are now unnecessary.

I'll likely put out a lib or update loadables chunk extractor.

The universal component is effectively dead on webpack 5. I can hold. There might be a small wrapper I create for react but it likely won't be universal. If it is, it's a total rebuild - since it still works- I'd prefer to leave it alone and build out federated application capabilities

I kind of understand. Right now we have one package utilizing this one for the default client-side export, and maybe 1 or 2 of server.js named exports.. and then all other modules import from that.. so rework could be minimal. Any quick thoughts are on what a best transition plan might look like?

They work almost exactly the same. I think you can just find replace it everywhere and then just re-hook up the chunkExtractor in your SSR. If you google module-federation-examples/server-side-rendering you'll find my MF repo and i use loadable in there, it was a retrofit of my old icarus project based on universal. So its literally a OSS port to loadable.

Hi @ScriptedAlchemy, can you please elaborate on this?

The universal component is effectively dead on webpack 5.

If this is true, you can mark this package as deprecated, isn't it? Otherwise updating this package requires updating React peer dep to ^16.3.0 || ^17.0.0", react-test-renderer dev dep to ^17.0.0, and merging #216. Fixing this circular dependency issue is also straightforward. I would be happy to push a PR but versions/tags of this repository is a real mess, sorry.

Won't deprecate till I have the chunk mechanics done. That said I no longer have time for this. If people want to PR, I'll merge things.

Will put a notice on When I have time

Can't reproduce the issue with webpack v4.43.2 or v5.3.2, though I had this issue in a fork of this repository bundled with Rollup.

@ScriptedAlchemy do you have any good resources you could point to on how to do ssr code splitting on webpack 5. Would you still rely on federation even for a single repo?