-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathindex.mjs
More file actions
21 lines (18 loc) · 756 Bytes
/
index.mjs
File metadata and controls
21 lines (18 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* ESM entry point for lambda-api
*
* This file provides ESM compatibility by ensuring require() is available
* for the CommonJS modules when bundled for ESM output.
*
* When bundlers like esbuild process this library for ESM output, this entry point
* ensures that the CommonJS code can still use require() for built-in Node.js modules.
*/
// Ensure require is available in ESM context (for esbuild bundles)
import { createRequire } from 'module';
if (typeof globalThis.require === 'undefined') {
globalThis.require = createRequire(import.meta.url);
}
// Import the CommonJS module
// Note: This dynamic import ensures require is set up before loading CommonJS code
const { default: api } = await import('./index.js');
export default api;