feat(dev): add a bundleable define entry point [Panda v2] - #3811
Merged
segunadebayo merged 5 commits intoSep 15, 2026
Merged
Conversation
Allow published design systems to bundle configuration helpers without retaining a runtime dependency on @pandacss/dev.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
@castrog is attempting to deploy a commit to the Chakra UI Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 153f720 The changes in this PR will be included in the next version bump. This PR includes changesets to release 23 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Generate the package export fixture in a temporary directory so the test cannot depend on missing or stale dist output.
Three of the four tests didn't pull their weight. `preserves root helper exports` asserted `a === b` across `export * from './define'`, so it could never fail. The two token tests covered `createProxy` in src/config.ts, which this PR doesn't change, and duplicated each other's shape. The remaining test is the one that can catch a real break: it builds src/define.ts and loads it through the package's `exports` map in a real Node process, so a bad export entry or a missing build target shows up.
The docs told you to bundle `@pandacss/dev/define` but never said what breaks if you don't, or why the subpath matters over the bare package name. Name the failure: skip the bundling step and your published JavaScript keeps a runtime import of `@pandacss/dev`, which dies in production with ERR_MODULE_NOT_FOUND once an app installs Panda as a dev dependency. Say why the subpath exists: `noExternal` matches whole packages, so `noExternal: ['@pandacss/dev']` also inlines `@pandacss/config` and `@pandacss/compiler-shared` when the build touches `@pandacss/dev/node`. The README entry called `/define` runtime-dependency-free, which describes the root entry just as well — both resolve to the same dependency-free module. The difference is that `/define` is separately addressable.
Despite its name it never loaded the published entry point. It ran its own tsup build of src/define.ts with --format esm --no-splitting --no-config, while the real build is --format=esm,cjs --splitting --cjsInterop --dts. A break in the shipped artifact would not have failed it. That bought 55 lines of mkdtemp, a synthetic package.json, two execFileSync calls and an inline --eval, to assert two identity functions return their argument. packages/dev goes back to having no tests, which is where it was before this branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@pandacss/dev/define, a runtime-dependency-free entry point for config definition helpers.@pandacss/devexports unchanged.defineTokens.colors()anddefineSemanticTokens.colors()./defineis bundled.Why
I use Panda definitions in a published design-system package. Importing helpers such as
definePatternfrom@pandacss/devcan leave a runtime import when the package is externalized. Production SSR deployments that omit build-time tooling then fail withERR_MODULE_NOT_FOUND.Bundlers externalize modules rather than individual exports. The dedicated subpath gives library authors a stable module they can include with
noExternalwhile leaving the rest of@pandacss/devexternal.This is the v2 companion to #3810. I kept it additive and limited to the package boundary; it does not change extraction or CSS output.
Verification
pnpm --filter @pandacss/dev buildpnpm test packages/devgit diff --checknoExternal: ['@pandacss/dev/define']; the 243-byte output had no remaining Panda imports and ran successfully in Node.The tests also load the built package export through Node, rather than relying only on Vitest source aliases.
The implementation appears safe to merge, with a non-blocking test-reliability issue around its dependency on pre-existing build output.
Fix with agent prompt
Summary
distfiles.Reviews (1) · Last reviewed commit: "feat(dev): add a bundleable define entry..."