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

Investigate CLI building twice when using watch #2613

Open
FrederikBolding opened this issue Jul 30, 2024 · 1 comment
Open

Investigate CLI building twice when using watch #2613

FrederikBolding opened this issue Jul 30, 2024 · 1 comment

Comments

@FrederikBolding
Copy link
Member

When using mm-snap watch, the CLI will rebuild the Snap twice after detecting a change in the source code. Once because the source file changed and once again because rebuilding causes snap.manifest.json to be updated.

We should look into minimizing this and strictly rebuilding when necessary.

@ritave ritave self-assigned this Jul 30, 2024
@ritave
Copy link
Member

ritave commented Aug 13, 2024

I've investigated the cause.

  1. We use webpack to watch the filesystem including the manifest
  2. We run the webpack plugin to update the manifest outside of webpack build process.
  3. Webpack notices that the manifest has been updated and rebuilds the bundle

I've tried the following:

  1. Webpack has no way to conditionally watch files
  2. Webpack has no way to abort the build for the second change
  3. Debouncing the build by collating modified files does not work
  4. Emitting the updated manifest using webpack APIs does not work

What we could do is to rewrite much of the snaps-cli to manually watch the manifest outside webpack and manually execute a webpack build on manifest update.

For the time being we decided to timebox this issue and not do it at this time.

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

2 participants