Skip to content

Commit 2c6a1b6

Browse files
committed
make sure to bundle vendor before testing and add changeset
1 parent 2d29f7a commit 2c6a1b6

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@trigger.dev/core": patch
3+
---
4+
5+
fix: vendor superjson to fix ESM/CJS compatibility
6+
7+
Bundle superjson during build to avoid `ERR_REQUIRE_ESM` errors on Node.js versions that don't support `require(ESM)` by default (< 22.12.0) and AWS Lambda which intentionally disables it.

packages/core/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@
162162
"bundle-vendor": "node scripts/bundle-superjson.mjs",
163163
"build": "pnpm run bundle-vendor && tshy && node scripts/bundle-superjson.mjs --copy && pnpm run update-version",
164164
"dev": "pnpm run bundle-vendor && tshy --watch",
165-
"typecheck": "tsc --noEmit -p tsconfig.src.json",
165+
"typecheck": "pnpm run bundle-vendor && tsc --noEmit -p tsconfig.src.json",
166+
"pretest": "pnpm run bundle-vendor",
166167
"test": "vitest",
167168
"check-exports": "attw --pack ."
168169
},

packages/core/scripts/bundle-superjson.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
* - Node.js versions before 22.12.0 (require(ESM) not enabled by default)
99
* - AWS Lambda (intentionally disables require(ESM))
1010
*
11+
* The output files are gitignored and regenerated during each build.
12+
* This script runs automatically as part of `pnpm run build`.
13+
*
1114
* Usage:
1215
* node scripts/bundle-superjson.mjs # Bundle to src/v3/vendor
1316
* node scripts/bundle-superjson.mjs --copy # Also copy to dist directories

0 commit comments

Comments
 (0)