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

Log to file? #78

Open
Nantris opened this issue Jun 23, 2021 · 2 comments
Open

Log to file? #78

Nantris opened this issue Jun 23, 2021 · 2 comments

Comments

@Nantris
Copy link

Nantris commented Jun 23, 2021

We tried wiring things up to have a file generated at startup, but unfortunately we can't find a way to prevent the plugin from constantly re-creating the files when the project is refreshed. If we try something like setting isCompleted = true inside of onEnd() - but isCompleted ends up being set to true before we'd expect and so no report files are generated. I looked at the code but can't figure out what might cause this. Maybe there's something I don't understand about how Webpack runs plugins?

@Nantris
Copy link
Author

Nantris commented Jun 23, 2021

Hard to guess... But logging to a file I found that the order of operations looks like this on startup:

  1. onStart <<< What's going on here?
  2. onEnd <<< What's going on here?
  3. onStart
  4. onDetected (however many times a circular dependency is detected
  5. onEnd

Anybody have any insights?

I was guessing maybe this has to do with multiple entry points, but we have three entry points and only two instances of onStart and onEnd.

@Nantris
Copy link
Author

Nantris commented Jun 23, 2021

The only workaround we can find is to do this in onEnd

if (numCyclesDetected) isCompleted = true;

When we do this, we avoid the false instant-completion from the initial onStart/onEnd runs. I have no idea what might cause this, but the workaround works, at least somewhat.

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

No branches or pull requests

1 participant