Skip to content

Build library and types with Vite only - #49

Open
edoardocavazza wants to merge 7 commits into
mainfrom
claude/synapse-vite-only-build
Open

Build library and types with Vite only#49
edoardocavazza wants to merge 7 commits into
mainfrom
claude/synapse-vite-only-build

Conversation

@edoardocavazza

Copy link
Copy Markdown
Member

Replace the esbuild + tsc + rimraf build pipeline with a single Vite library build, mirroring chialab/dna: a new vite.lib.config.ts bundles src/index.ts with @chialab/dna kept external, and the unplugin-isolated-decl plugin emits co-located .d.ts files per module instead of a separate types/ folder generated by tsc.

tsconfig.json now sets noEmit + isolatedDeclarations (tsc is kept only as a type-check gate, wired into the test script, same as DNA's test:typings). Every exported function/method/accessor that lacked an explicit type annotation got one, as isolatedDeclarations requires per-file type information with no cross-file inference.

package.json's exports.types now points at dist/synapse.d.ts instead of types/index.d.ts, and esbuild/rimraf are dropped from devDependencies.

Replace the esbuild + tsc + rimraf build pipeline with a single
Vite library build, mirroring chialab/dna: a new vite.lib.config.ts
bundles src/index.ts with @chialab/dna kept external, and the
unplugin-isolated-decl plugin emits co-located .d.ts files per
module instead of a separate types/ folder generated by tsc.

tsconfig.json now sets noEmit + isolatedDeclarations (tsc is kept
only as a type-check gate, wired into the test script, same as
DNA's test:typings). Every exported function/method/accessor that
lacked an explicit type annotation got one, as isolatedDeclarations
requires per-file type information with no cross-file inference.

package.json's exports.types now points at dist/synapse.d.ts
instead of types/index.d.ts, and esbuild/rimraf are dropped from
devDependencies.
@changeset-bot

changeset-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f1b71a8

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

claude and others added 6 commits August 26, 2026 08:08
vite.config.ts is now the library build config (previously
vite.lib.config.ts) and doubles as the default used by Vite tooling
(e.g. IDE integration, vitest). The demo/pages app gets its own
vite.demo.config.ts, referenced explicitly by the dev and
pages:build scripts.
Enable vitest's typecheck for all of src/**/*.{ts,tsx}, so `vitest run`
(and therefore `yarn test`) always typechecks the library on its own.
Drop the now-redundant "types" script and its "yarn types &&" prefix
on "test".
Drop the resolve.alias from vite.demo.config.ts and have the demo's
own files import the library source with a relative path instead,
so the demo no longer needs any bundler-level indirection to pick up
local source changes.

Bump vite to ^8.0.0 (Rolldown-powered) and switch vite.config.ts's
lib build from rollupOptions to rolldownOptions, matching DNA. The
external matcher is narrowed to just @chialab/dna (and its
subpaths): a broader "externalize anything non-relative" matcher
also caught Rolldown's own injected @oxc-project/runtime helpers
(needed for decorators/private fields), leaving them as unresolved
imports in the published bundle instead of inlined.
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

Successfully merging this pull request may close these issues.

2 participants