Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion rivetkit-typescript/packages/rivetkit/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineConfig({
// browser builds when importing from rivetkit/client.
// See: https://github.com/egoist/tsup/issues/958
shims: false,
esbuildOptions(options) {
esbuildOptions(options, context) {
// Mark @rivetkit workspace packages as external to preserve their dependency chains
options.external = [
...(options.external || []),
Expand All @@ -21,6 +21,18 @@ export default defineConfig({
"@rivetkit/workflow-engine",
"@rivet-dev/agent-os-core",
];
// `shims: false` (above) keeps ESM shims out of the browser build, but it
// also leaves `import.meta.url` (used by getRequireFn in src/utils/node.ts)
// emitted verbatim into the CJS output — a SyntaxError at load time for any
// CommonJS consumer (e.g. importing `rivetkit` under ts-node / a CJS host).
// Define a CJS-safe replacement for the CJS format only; ESM keeps native
// import.meta.
if (context.format === "cjs") {
options.define = {
...(options.define || {}),
"import.meta.url": "require('url').pathToFileURL(__filename).href",
};
}
},
define: {
"globalThis.CUSTOM_RIVETKIT_DEVTOOLS_URL": process.env
Expand Down