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

In the app-shell example debugging mode, saving package.json will prompt that the port is used #671

Closed
3 tasks done
carvinlo opened this issue Feb 4, 2024 · 6 comments · Fixed by #675
Closed
3 tasks done
Labels
bug Something isn't working cli Concerns the piral-cli application.
Milestone

Comments

@carvinlo
Copy link
Contributor

carvinlo commented Feb 4, 2024

Bug Report

For more information, see the CONTRIBUTING guide.

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version?
  • Did you perform a search in the issues?

Environment Details and Version

  • macos
  • vscode
  • node@18

Description

In the app-shell example debugging mode, saving package.json will prompt that the port is used. Continue to save component files, webpack will perform multiple compilations

Steps to Reproduce

  1. yarn && yarn build && cd src/samples/minimal-piral && npx -y piral debug
  2. Press the command + s shortcut key to save the src/samples/minimal-piral/package.json file
image 3. Press the `command + s` shortcut key to save the `src/samples/minimal-piral/src/index.tsx` file image

Expected behavior

  1. Always use the specified port number
  2. webpack always builds only once

Actual behavior

  1. prompt that the port is used
  2. webpack performs multiple builds

Possible Origin/Solution

Is the piral-cli watcher did not reset the hmr watcher when restarting the pilet build? Some vscode plug-ins will modify package.json, thereby triggering the execution of the piral-cli watcher callback function?

2024-02-04_23-11-08 (2)

@carvinlo carvinlo added the bug Something isn't working label Feb 4, 2024
@FlorianRappl FlorianRappl added this to the 1.5.0 milestone Feb 4, 2024
@FlorianRappl FlorianRappl added in-review The item is currently being reviewed. cli Concerns the piral-cli application. labels Feb 4, 2024
FlorianRappl added a commit that referenced this issue Feb 5, 2024
@FlorianRappl FlorianRappl added in-implementation The item is currently being implemented. and removed in-review The item is currently being reviewed. labels Feb 5, 2024
FlorianRappl added a commit that referenced this issue Feb 8, 2024
@FlorianRappl FlorianRappl added in-testing The item is already out in preview and can be tested. and removed in-implementation The item is currently being implemented. labels Feb 8, 2024
@FlorianRappl
Copy link
Contributor

Thanks for the report. A fix for this is out with the latest preview (next).

@FlorianRappl FlorianRappl removed the in-testing The item is already out in preview and can be tested. label Feb 8, 2024
@carvinlo
Copy link
Contributor Author

carvinlo commented Feb 8, 2024

I tested and it was fixed, thank you!

@carvinlo
Copy link
Contributor Author

carvinlo commented Feb 9, 2024

There are the same problem with using pilet debug command in a monorepo. See the mwe

Environment Details and Version
piral-cli@1.5.0-beta.6684

Expected behavior
webpack always builds only once

Actual behavior
webpack performs multiple builds

  1. yarn && yarn build && cd src/samples/sample-pilet && yarn start
  2. Press the command + s shortcut key to save the src/samples/sample-pilet/package.json file
  3. Press the command + s shortcut key to save the src/samples/sample-pilet/src/index.tsx file
image

@FlorianRappl
Copy link
Contributor

We restart the process independent of what the bundler does. So in case of Webpack it might be sensitive to the package.json, however, this is nothing we control or will change.

If this edge case really impacts you (how?) then configure webpack to ignore the package.json. I think this is rather a cosmetic issue and for reliability it makes more sense that we restart the process than having just a single build here.

@carvinlo
Copy link
Contributor Author

carvinlo commented Feb 9, 2024

We restart the process independent of what the bundler does. So in case of Webpack it might be sensitive to the package.json, however, this is nothing we control or will change.

If this edge case really impacts you (how?) then configure webpack to ignore the package.json. I think this is rather a cosmetic issue and for reliability it makes more sense that we restart the process than having just a single build here.

I completely agree with your idea, but the repeated build may be related to not restarting webpack when restarting the pilet process. After testing, pr fixed this problem. But since I don’t fully understand the logic of piral-cli, I don’t know if pr is reasonable.

@FlorianRappl
Copy link
Contributor

Actually it is very reasonable. Thanks for spotting - with my answer I thought we already spot it and what you see is the triggering beforehand, but actually the bundler process keeps on running.

Perfect PR - wonderful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Concerns the piral-cli application.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants