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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have to clear cache and restart parcel on each almost each save #9729

Open
a-rasin opened this issue May 20, 2024 · 4 comments
Open

Have to clear cache and restart parcel on each almost each save #9729

a-rasin opened this issue May 20, 2024 · 4 comments

Comments

@a-rasin
Copy link

a-rasin commented May 20, 2024

馃悰 bug report

Changes aren't getting picked up after the first save. I need to constantly clear the cache and rerun parcel.
Other team members can run it fine (only hmr doesn't work for them) but for me the page in the browser doesn't change. Even with reloading and hard reloading notihng changes. I can see parcel doing some work building something but changes are not reflected in the browser unless I clear the cache and rerun parcel. This sounds extremely similar to #5660 but saving a file with echo changes nothing so the cause seems slightly different

馃帥 Configuration (.babelrc, package.json, cli command)

NODE_ENV=development parcel --port 9000

馃 Expected Behavior

Rebuild on every save and at least by refreshing the browser I get the latest code.

馃槸 Current Behavior

After one or two saves the page in the browser remains the same literally nothing changes. Parcel is building something in the terminal but it is not reflected in the browser even if I refresh.

馃敠 Context

Been experiencing this issue probably for a year now it used to stop picking up changes after about 4 edits per file but now it reduced to 1 and it's driving me nuts my productivity is destroyed

馃捇 Code Sample

Sorry can't share the code

馃實 Your Environment

Software Version(s)
Parcel 2.11.0 tried with some earlier versions and also v2.8.2
Node 22.2.0 but tried with older versions possibly 20.x.x
npm/Yarn 1.22.22
Operating System arch linux, 6.8.9 tried with older versions as well
@a-rasin
Copy link
Author

a-rasin commented May 21, 2024

Also I think at some point parcel seems to stops doing any building on the terminal as well.

I am willing to try and work on this or at least debug it further using the source code.
Any pointers for where to look or any potential causes would be very helpful.

@mischnic
Copy link
Member

There are three stages where it could break:

  1. The file watcher should pick up all changes
    That happens here
    async (err, events) => {
  2. Parcel should detect that the change should cause transformers to rerun and bundles to be rebuilt
    respondToFSEvents is responsible for determining what has to be recomputed:
    async respondToFSEvents(

    (Then, for example @parcel/transformer-js and @parcel/packager-js should rerun).
  3. In the browser, HMR should handle the update from the dev server and either update in place or reload.
    The updates are received here:
    ws.onmessage = async function (event /*: {data: string, ...} */) {

For more logging inside Parcel (in the functions I referenced above), you can add console.log statements to e.g. node_modules/@parcel/core/lib/Parcel.js and node_modules/@parcel/transformer-js/lib/JSTransformer.js. Run it as yarn parcel build ... | cat to prevent log message from being cleared after builds.

@benasher44
Copy link

Would it be possible to do a release that adds logging behind a flag (verbose or an env flag)? I can yarn patch it, but it might be more helpful to have logs that contain the information you would need/want for a more detailed bug report.

@a-rasin
Copy link
Author

a-rasin commented May 31, 2024

Ok, so something I noticed. I'm trying out emacs this is my second day using it and I noticed that parcel works with it. Previously I was using neovim. I'm guessing the way that neovim saves files doesn't trigger a rebuild at least not in the correct manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants