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

dev command #49

Open
acao opened this issue Dec 3, 2022 · 5 comments
Open

dev command #49

acao opened this issue Dec 3, 2022 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@acao
Copy link

acao commented Dec 3, 2022

I see that there is a no-op todo message for this flag! What issues do you foresee with implementing a build watcher?

Here is some prior art:

https://github.com/search?q=repo%3Aegoist%2Ftsup%20watch&type=code

of course it has more complexity to concern itself with than we do with only esbuild, but it's a start. also I don't see this implementation utilizing rebuild method that esbuild returns to make incremental builds work

I would be happy to help contribute this as part of our graphql/graphiql#2925 effort

@cometkim cometkim added the enhancement New feature or request label Dec 3, 2022
@cometkim
Copy link
Owner

cometkim commented Dec 3, 2022

I'm more focused on getting the build right in v1. But this will definitely be on my future tasks!

For TypeScript projects, I can imagine a scenario where type-checks are prioritized and then incremental builds are performed if they pass. What would be the ideal dev mode experience imaginable if you weren't using TypeScript?

@cometkim cometkim added this to the v1.x milestone Dec 4, 2022
@cometkim
Copy link
Owner

I will add nanobundle dev command.

I'd like to mention that the experience design for this is complex compared to other tools. This is because nanobundle doesn't just act as a proxy for tsc, also needs to support multiple entries.

But naively reporting all diagnostics for all entries during development won't work very well. Not necessarily simultaneous. One of the best rules of thumb for a good development experience (especially when refactoring types) is "focus on one problem at a time".

@easylogic
Copy link

I am replacing watch in the following way. please refer to this.

    "watch": "chokidar \"src/*\" -c \"npm run nano:build\" --polling",

@cometkim cometkim changed the title --watch flag dev command Jan 8, 2023
@cometkim
Copy link
Owner

cometkim commented May 18, 2023

Drops some implementation ideas here:

While esbuild's watch and node's fs.watchFile use stats polling, node's fs.watch provides an optimized implementation for each platform, so it would be reasonable to implement based on this.

Also, instead of recursively traversing a specific path, selecting only the modules reachable from the entry point inferred from the manifest effectively narrows the watch and makes better system compatibility. Perhaps it should run esbuild with two-path for this.

@cometkim
Copy link
Owner

All entries and their dependencies should be watched in the soon-to-be-added "unbundle" mode (#166).

How about in bundling mode? Typically, we don't test multiple entries at once in development, so maybe we can narrow it down to some of the JS bundle groups.

  • the main entry
  • exported to subpath
  • module format matching package type
  • development condition

@cometkim cometkim mentioned this issue May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants