justjake / quickjs-emscripten

Safely execute untrusted Javascript in your Javascript, and execute synchronous code that uses async functions
https://www.npmjs.com/package/quickjs-emscripten
Other
1.27k stars 95 forks source link

Can't run cloudflare example #163

Closed cosbgn closed 6 months ago

cosbgn commented 6 months ago

When running the cloudflare example locally (and when deployed) I get the following.

Steps I did:

- npm i 
- npm i quickjs-emscripten
- [removed the extra comma on line 40](https://github.com/justjake/quickjs-emscripten/blob/main/examples/cloudflare-workers/src/index.mts#L40C1-L40C4)
- npm run dev 
- npm run deploy

These are the errors:

✘ [ERROR] quickjs-emscripten: QTS_Eval: Detected module = false
✘ [ERROR] quickjs-emscripten: QTS_Eval: JS_EVAL_TYPE_GLOBAL eval_result
✘ [ERROR] quickjs-emscripten: QTS_Eval: eval_result = 0
✘ [ERROR] quickjs-emscripten: QTS_Eval: non-module or exception
[wrangler:err] SyntaxError: expecting ';'
[wrangler:inf] GET / 500 Internal Server Error (169ms)

Am I missing something?

cosbgn commented 6 months ago

Closing, it works if you pass a proper code string