Skip to content

fix(unplugin-typegpu): expose built artifacts via $built$ exports#2622

Open
mvanhorn wants to merge 1 commit into
software-mansion:mainfrom
mvanhorn:fix/2605-unplugin-built-exports
Open

fix(unplugin-typegpu): expose built artifacts via $built$ exports#2622
mvanhorn wants to merge 1 commit into
software-mansion:mainfrom
mvanhorn:fix/2605-unplugin-built-exports

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

Adds $built$ sibling entries to the dev exports map in packages/unplugin-typegpu/package.json so consumers can opt into the compiled dist/*.js artifacts 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.ts for types). The original ./src/*.ts entries are left untouched, and publishConfig.exports is unchanged.

This mirrors the exact mechanism already used by the sibling typegpu package, which exposes $built$ variants of each export pointing at its compiled dist output.

Why this matters

Today the dev exports map 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 .ts source is imported. Issue #2605 requests exactly this, and the maintainer confirmed the direction:

"We could use the same mechanism we use for the typegpu package, and expose the built package artifacts under unplugin-typegpu/babel/$built$."

Testing

  • package.json remains valid JSON.
  • pnpm --filter unplugin-typegpu build (tsdown) produces every referenced dist file; no $built$ entry points at a non-existent artifact (all 11 subpaths cross-checked against the tsdown entry list).
  • Runtime resolution verified: require('unplugin-typegpu/babel/$built$') resolves to the compiled ./dist/babel.js.
  • pnpm --filter unplugin-typegpu test:types passes; oxlint and oxfmt --check report no issues on the changed file.

Fixes #2605

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.
Copilot AI review requested due to automatic review settings June 17, 2026 10:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 types to dist/*.d.ts and runtime to dist/*.js

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +32 to +35
"./$built$": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
Comment on lines +32 to +35
"./$built$": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
Comment on lines +33 to +34
"types": "./dist/index.d.ts",
"default": "./dist/index.js"

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ 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>.js and ./dist/<name>.d.ts.
  • Original source exports and publishConfig.exports untouched — only the dev exports map is extended.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@iwoplaza iwoplaza left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The exports only include the ESM export, I'd like them to export both the ESM and CJS exports, just like the published package

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.

fix: unplugin-typegpu exports .ts file when imported from workspace:*

3 participants