question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove Circular Dependencies

See original GitHub issue

Bug Report

Ionic version: [x] 4.x

Current behavior: Compiling with Webpack still fails on latest versions of everything from a fresh install today. Doing as little as importing components breaks it.

Expected behavior: Webpack should be able to compile this either with updates to this package or maybe via a plugin or something…

Steps to reproduce: See related issues: #17456, #13797

Related code: See related issues: #17456, #13797

Other information:

Error: Cyclic dependency
    at visit (/path/to/node_modules/toposort/index.js:35:13)
    at visit (/path/to/node_modules/toposort/index.js:53:9)
    at visit (/path/to/node_modules/toposort/index.js:53:9)
    at Function.toposort [as array] (/path/to/node_modules/toposort/index.js:22:22)
    at Object.module.exports.dependency (/path/to/node_modules/html-webpack-plugin/lib/chunksorter.js:50:35)
    at HtmlWebpackPlugin.sortChunks (/path/to/node_modules/html-webpack-plugin/index.js:364:35)
    at /path/to/node_modules/html-webpack-plugin/index.js:113:21
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/path/to/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at Compiler.emitAssets (/path/to/node_modules/webpack/lib/Compiler.js:441:19)
    at onCompiled (/path/to/node_modules/webpack/lib/Watching.js:50:19)
    at hooks.afterCompile.callAsync.err (/path/to/node_modules/webpack/lib/Compiler.js:631:15)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/path/to/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at compilation.seal.err (/path/to/node_modules/webpack/lib/Compiler.js:628:31)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/path/to/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/path/to/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.optimizeAssets.callAsync.err (/path/to/node_modules/webpack/lib/Compilation.js:1329:35)

Ionic info: Not using the Ionic CLI…

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
alexwebercommented, May 17, 2019

Hi @liamdebeasi , I was essentially just re-opening the last issue (#17456) that got closed due to inactivity but is still ocurring. I’m using ionic react 0.05 and trying to mimic the conference app setup on a minimal custom webpack + babel build environment. The components won’t even import…

It it works with create react app which is essentially the same thing with more stuff then I might be missing something with my custom build, I’ll spin it up with CRA and see what the differences are ocne it’s ejected…

1reaction
kobylcommented, Jun 18, 2019

@alexweber - There’s a day I’m not getting back… 😦

This is caused by HtmlWebpackPlugin. As we noted this works with react-scripts, but as it turns out this was a problem at one point. https://github.com/facebook/create-react-app/issues/4667

The bug was closed without a final solution, but the workaround posted worked for me. You just need to tell the thing not to sort.

    new HtmlWebpackPlugin({
...
      chunksSortMode: 'none'

And voila.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Eliminate Circular Dependencies from Your JavaScript ...
There are a couple of options to get rid of circular dependencies. For a longer chain, A -> B -> C -> D...
Read more >
How to remove circular dependency between two classes in a ...
You have to evaluate your class design using the Single Responsibility Principle. You will have to rewrite your classes and introduce new ones....
Read more >
How to solve circular dependency?
Try identify your objects going backwards asking what (object) do you need for previous one to work - for example: File(filename).write(Report); ...
Read more >
Circular Dependencies in Spring - Baeldung
A quick writeup on dealing with circular dependencies in Spring: how they occur and several ways to work around them.
Read more >
How to fix nasty circular dependency issues once and for all in ...
Although there are many strategies and best practices on how to avoid circular dependencies. There is very little on how to fix them...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found