Skip to content

Commit 718a8b9

Browse files
committed
build(shared): nest internal build chunks under _chunks/
Rolldown's content-hashed shared chunks were emitted flat in dist/runtime alongside the entry points. Since the package exposes "./*" mapping to dist/runtime/*, those chunks were enumerated as public subpaths and surfaced as phantom breaking changes in API-diff tooling whenever a chunk hash changed. Route them into dist/runtime/_chunks/ so the single-segment wildcard glob only matches real entry points. Runtime and type resolution are unchanged.
1 parent 8d6bb56 commit 718a8b9

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/shared': patch
3+
---
4+
5+
Nest rolldown's shared build chunks under `dist/runtime/_chunks/` instead of emitting them flat next to the entry points. The package exposes `"./*"`, which resolves to `dist/runtime/*`, so the content-hashed internal chunks were being surfaced as public subpaths and showed up as phantom breaking changes in API-diff tooling whenever a chunk hash shifted. Entry and type resolution are unchanged; the chunks are still referenced by relative path.

packages/shared/tsdown.config.mts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,23 @@ export default defineConfig(({ watch, env }) => {
5555
],
5656
outDir: './dist/runtime',
5757
unbundle: false,
58+
// Route rolldown's shared chunks into a nested `_chunks/` directory. The
59+
// package's `"./*"` wildcard export resolves to `dist/runtime/*`, and
60+
// tooling that globs that surface (e.g. break-check's API snapshot) uses
61+
// a single-segment `*`, so content-hashed internal chunks sitting flat in
62+
// `dist/runtime` get enumerated as phantom public subpaths. Nesting them
63+
// one level down keeps them out of the wildcard's reach while runtime
64+
// resolution (relative imports between entries and chunks) is unchanged.
65+
outputOptions: options => {
66+
const { chunkFileNames } = options;
67+
return {
68+
...options,
69+
chunkFileNames:
70+
typeof chunkFileNames === 'function'
71+
? info => `_chunks/${chunkFileNames(info)}`
72+
: `_chunks/${chunkFileNames ?? '[name]-[hash].js'}`,
73+
};
74+
},
5875
},
5976
];
6077
});

0 commit comments

Comments
 (0)