Skip to content

Commit 6475016

Browse files
kubeclaude
andcommitted
Externalise use-sync-external-store in petrinaut lib build
@tanstack/react-form → @tanstack/react-store pulls in the pure-CJS use-sync-external-store, whose `require("react")` calls were surviving rolldown's lib build (react is external) as a runtime require helper that throws in the browser. Externalising use-sync-external-store and its subpaths pushes the CJS→ESM interop to the consumer's bundler, which handles it via pre-bundling. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6d3b19c commit 6475016

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

libs/@hashintel/petrinaut/vite.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ export default defineConfig(({ command }) => ({
2222
"react-dom",
2323
"@xyflow/react",
2424
"@babel/standalone",
25+
// Pure-CJS dep pulled in transitively by @tanstack/react-form →
26+
// @tanstack/react-store. Rolldown can't safely transform its
27+
// `require("react")` when react is external, so it falls back to a
28+
// runtime require helper that throws in the browser. Externalising it
29+
// pushes CJS→ESM interop to the consumer's bundler.
30+
/^use-sync-external-store(\/.*)?$/,
2531
],
2632
output: {
2733
globals: {

0 commit comments

Comments
 (0)