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

[feature] support a “liveDev + noBuild” mode #101

Open
lukekarrys opened this issue Feb 16, 2025 · 2 comments
Open

[feature] support a “liveDev + noBuild” mode #101

lukekarrys opened this issue Feb 16, 2025 · 2 comments

Comments

@lukekarrys
Copy link

With Node being able to run TypeScript, I experimented with a version of tshy that when liveDev: true is set:

  • doesn’t run tsc, so there is no dist folder
  • points the default export at the files in src

And it’s pretty nice in a monorepo. Everything imports and runs the TypeScript directly, and during pack or publish it still builds and configures exports for the dist files.

Would tshy ever support a new option for this?

lukekarrys added a commit to vltpkg/vltpkg that referenced this issue Feb 20, 2025
)

`tshy`-able workspaces no longer need preparing. This is the result of all the
previous PRs running TypeScript source directly. The `docs` and `gui` still have
prepare scripts since those still need preparing for the web.

The `docs` prepare script has been sped up so it doesn't run `typedoc` anymore.
For docs it only needs to build the astro typedefs so that editors/linting have
those available. The full build process for the docs now only runs during the
build on Vercel.

---

This also includes a patched version of tshy to make the default export
condition point directly at the TypeScript source and not actually build
anything to ./dist. This allows us to remove all the custom config tooling
conditions and needing to set --condition in NODE_OPTIONS. This patch should get
removed if this or a similar feature lands in tshy:
isaacs/tshy#101

tshy will still do the right thing and build/export ./dist files when run during
workspace pack or publish. We're not actively publishing our workspaces but it's
nice that this will Just Work when we do.
@isaacs
Copy link
Owner

isaacs commented Feb 21, 2025

Link direct to source iff:

  1. liveDev is true (ie, set in options, and also not prepare or publish or something like that)
  2. Current dialect is esm
  3. No polyfills exist for current dialect
  4. Root package.json is type: 'module'

@isaacs
Copy link
Owner

isaacs commented Feb 21, 2025

@colinhacks What's your sense on this? Would this be helpful for you? I feel like zod and vlt are working on similar dev setup philosophies.

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