You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
ESBuild has issues building this library.
The three issues I am having:
(build time) ../../node_modules/ky-universal/index.js:28:30: ERROR: Top-level await is currently not supported with the "cjs" output format
Related to Lack of CommonJS support #49 (comment)
(runtime) TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined (tracked this down to an issue in web-workers
4 Attempt to build using `yarn esbuild src/index.ts --bundle --outfile=out.js --platform=node
I get:
$ /Users/daniel/code/civicteam/polypass/node_modules/.bin/esbuild src/index.ts --bundle --outfile=out.js --platform=node
✘ [ERROR] Top-level await is currently not supported with the "cjs" output format
I can hack around this by going into node_modules/@digitalbazaar/http-client/dist/cjs/index.cjs and replacing the import of ky-universal with ky.
Building then works, but I get the other two issues at runtime. I don't think they are related to ky-universal
Expected behavior
Building should work and the createAuthorizationRequestWithMessage function should execute at runtime, resulting in a login JSON
Screenshots
If applicable, add screenshots to help explain your problem.
** Environment info (please complete the following information):**
Mac OS
Node 18-17
Package version 1.0.0-beta.7
Build cjs
Additional context
I first experienced this using serverless with AWS lambda. Steps to reproduce that:
Describe the bug
ESBuild has issues building this library.
The three issues I am having:
(build time) ../../node_modules/ky-universal/index.js:28:30: ERROR: Top-level await is currently not supported with the "cjs" output format
Related to Lack of CommonJS support #49 (comment)
(runtime) TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined (tracked this down to an issue in web-workers
(runtime Runtime.ImportModuleError: Error: Cannot find module './fetch.node'
To Reproduce
First issue
src/index.ts
4 Attempt to build using `yarn esbuild src/index.ts --bundle --outfile=out.js --platform=node
I get:
I can hack around this by going into
node_modules/@digitalbazaar/http-client/dist/cjs/index.cjs
and replacing the import of ky-universal with ky.Building then works, but I get the other two issues at runtime. I don't think they are related to ky-universal
Expected behavior
Building should work and the createAuthorizationRequestWithMessage function should execute at runtime, resulting in a login JSON
Screenshots
If applicable, add screenshots to help explain your problem.
** Environment info (please complete the following information):**
Additional context
I first experienced this using serverless with AWS lambda. Steps to reproduce that:
then you can add the same code to the file src/functions/hello/handler.ts
then call
yarn serverless invoke local --function hello
The text was updated successfully, but these errors were encountered: