Skip to content

Commit 2e1f698

Browse files
committed
shim otel, so things work when deploying from outside of this repo
1 parent fc55e71 commit 2e1f698

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/build/functions/edge.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,21 @@ export const createEdgeHandlers = async (ctx: PluginContext) => {
273273
await mkdir(dirname(dummyChunkPath), { recursive: true })
274274
await writeFile(dummyChunkPath, '')
275275

276+
// there is also `@opentelemetry/api` require that fails esbuild due to nothing matching,
277+
// next is try/catching it and fallback to bundled version of otel package in case of errors
278+
const otelApiPath = join(
279+
fakeNodeModulePath,
280+
'node_modules',
281+
'@opentelemetry',
282+
'api',
283+
'index.js',
284+
)
285+
await mkdir(dirname(otelApiPath), { recursive: true })
286+
await writeFile(
287+
otelApiPath,
288+
`throw new Error('this is dummy to satisfy esbuild used for npm compat using fake module')`,
289+
)
290+
276291
// await writeHandlerFile(ctx, definition)
277292

278293
const nextConfig = ctx.buildConfig

0 commit comments

Comments
 (0)