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

templates(express): use watcher.on("add").on("change") #6922

Closed
wants to merge 5 commits into from

Conversation

xHomu
Copy link
Contributor

@xHomu xHomu commented Jul 21, 2023

Also add in comments on what to change for CJS

Does not close #6919 but the debugger might help with bug tracking.

  • Docs

This actually get the express template in line with existing v2 dev doc changes.

Testing Strategy:

Also add in comments on what to change for CJS
@changeset-bot
Copy link

changeset-bot bot commented Jul 21, 2023

⚠️ No Changeset found

Latest commit: 3dc9615

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

broadcastDevReady(build);
}

chokidar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chokidar isn't a production dependency, so it would be better to use (await import("chokidar")), remove the chokidar import at the top of the file, make createDevRequestHandler() async, and await on it at the app.all() handler.

Copy link
Contributor Author

@xHomu xHomu Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the patch to use await import, not sure if it's the best way to write this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my code, I imported directly in the createDevRequestHandler() function, but this way is probably the cleanest if swapping in CJS is important.

@pcattori pcattori self-assigned this Aug 4, 2023
@pcattori pcattori marked this pull request as draft August 15, 2023 16:14
@MichaelDeBoey MichaelDeBoey changed the title Use watcher.on("add").on("change") for express template templates(express): use watcher.on("add").on("change") Aug 16, 2023
@MichaelDeBoey
Copy link
Member

@pcattori @xHomu Is this still relevant now that #7303 is merged?

@xHomu
Copy link
Contributor Author

xHomu commented Aug 31, 2023

Probably not. Should close this and rewrite express server.js with updated syntax.

@xHomu xHomu closed this Aug 31, 2023
@ngbrown
Copy link
Contributor

ngbrown commented Sep 3, 2023

These changes also updated the template to address the race condition described in #6831/#6919. The changes in #7303 didn't address that.

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

Successfully merging this pull request may close these issues.

Dev Server crashes if saving before the last rebuild complete
5 participants