Skip to content

Commit 8235cac

Browse files
committed
Expose esbuild keepNames option (experimental)
1 parent c8d252e commit 8235cac

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.changeset/gold-insects-invite.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"trigger.dev": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
Expose esbuild `keepNames` option (experimental)

packages/cli-v3/src/build/bundle.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,10 @@ async function createBuildOptions(
174174
options: BundleOptions & { entryPoints: string[]; buildResultPlugin?: esbuild.Plugin }
175175
): Promise<esbuild.BuildOptions & { metafile: true }> {
176176
const customConditions = options.resolvedConfig.build?.conditions ?? [];
177-
178177
const conditions = [...customConditions, "trigger.dev", "module", "node"];
179178

179+
const keepNames = options.resolvedConfig.build?.experimental_keepNames ?? false;
180+
180181
const $buildPlugins = await buildPlugins(options.target, options.resolvedConfig);
181182

182183
return {
@@ -193,6 +194,7 @@ async function createBuildOptions(
193194
sourcemap: true,
194195
sourcesContent: options.target === "dev",
195196
conditions,
197+
keepNames,
196198
format: "esm",
197199
target: ["node20", "es2022"],
198200
loader: {

packages/core/src/v3/config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,19 @@ export type TriggerConfig = {
183183
*/
184184
experimental_autoDetectExternal?: boolean;
185185

186+
/**
187+
* **WARNING: This is an experimental feature and might be removed in a future version.**
188+
*
189+
* Preserve the original names of functions and classes in the bundle. This can fix issues with frameworks that rely on the original names for registration and binding, for example MikroORM.
190+
*
191+
* @link https://esbuild.github.io/api/#keep-names
192+
*
193+
* @default false
194+
*
195+
* @deprecated (experimental)
196+
*/
197+
experimental_keepNames?: boolean;
198+
186199
jsx?: {
187200
/**
188201
* @default "React.createElement"

0 commit comments

Comments
 (0)