fix(unplugin-typegpu): expose built artifacts via $built$ exports#2622
fix(unplugin-typegpu): expose built artifacts via $built$ exports#2622mvanhorn wants to merge 1 commit into
Conversation
Add $built$ sibling entries to the dev exports map so consumers can opt into the compiled dist artifacts instead of the raw TypeScript source, mirroring the mechanism already used by the typegpu package.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds explicit “built” export subpaths for unplugin-typegpu so consumers can import precompiled JS + .d.ts from dist/ alongside the existing TS source exports.
Changes:
- Added
./$built$export entries for the main entry and each bundler integration (rollup, vite, webpack, etc.) - Each new built export maps
typestodist/*.d.tsand runtime todist/*.js
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "./$built$": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| }, |
| "./$built$": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| }, |
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — adds $built$ sibling entries to the dev exports map so consumers can opt into compiled artifacts, matching the mechanism already used by the typegpu package.
- Add
$built$export subpaths for all 11 entry points — each existing subpath (.,rollup,babel,bun,esbuild,farm,rolldown,rolldown-browser,rspack,vite,webpack) gains a matching<subpath>/$built$entry pointing at./dist/<name>.jsand./dist/<name>.d.ts. - Original source exports and
publishConfig.exportsuntouched — only the devexportsmap is extended.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
iwoplaza
left a comment
There was a problem hiding this comment.
The exports only include the ESM export, I'd like them to export both the ESM and CJS exports, just like the published package

Summary
Adds
$built$sibling entries to the devexportsmap inpackages/unplugin-typegpu/package.jsonso consumers can opt into the compileddist/*.jsartifacts instead of the raw TypeScript source. Every existing subpath (.,rollup,babel,bun,esbuild,farm,rolldown,rolldown-browser,rspack,vite,webpack) gains a matching<subpath>/$built$entry resolving to./dist/<name>.js(and./dist/<name>.d.tsfor types). The original./src/*.tsentries are left untouched, andpublishConfig.exportsis unchanged.This mirrors the exact mechanism already used by the sibling
typegpupackage, which exposes$built$variants of each export pointing at its compileddistoutput.Why this matters
Today the dev
exportsmap points every subpath directly at./src/*.ts. When the package is consumed outside the dev/monorepo resolution (or when a consumer simply wants the compiled output), there is no way to opt into the built artifacts, so the raw.tssource is imported. Issue #2605 requests exactly this, and the maintainer confirmed the direction:Testing
package.jsonremains valid JSON.pnpm --filter unplugin-typegpu build(tsdown) produces every referenceddistfile; no$built$entry points at a non-existent artifact (all 11 subpaths cross-checked against the tsdown entry list).require('unplugin-typegpu/babel/$built$')resolves to the compiled./dist/babel.js.pnpm --filter unplugin-typegpu test:typespasses;oxlintandoxfmt --checkreport no issues on the changed file.Fixes #2605