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
Using sdk with cloudflare workers in dev environment breaks wrangler dev.
I am using:
"@codesandbox/sdk": "^0.0.10"
I have compatibility_flags = ["nodejs_compat"] in my wrangler.toml file
I am getting the following error when running wrangler dev
✘ [ERROR] service core:user:cs-test: Uncaught TypeError: The argument 'path' The argument must be a file URL object, a file URL string, or an absolute path string.. Received 'undefined'
at null.<anonymous> (node:module:12:15) in createRequire
at null.<anonymous> (index.js:14007:38) in createRequire
at null.<anonymous> (index.js:14018:16)
After digging into to my node_modules I found that the node_modules/@codesandbox/sdk/dist/esm/index.edge.js file has the following content:
import{createRequire}from'module'constrequire=createRequire(import.meta.url)// ... more code below
Where the const require is not used anywhere. When I commented it out and the code looked like this:
import{createRequire}from'module'// const require = createRequire(import.meta.url)// ... more code below
Then it's working correctly and I can use the sdk to create and interact with sandboxes. So, import.meta.url is not available. If I use require to import @codesandbox/sdk then it works correctly but I don't want to do that. Could someone look into it or tell me a workaround?
Also would like to be sure if it is a config issue with cjs/esm :(
The text was updated successfully, but these errors were encountered:
Very interesting... I added that snippet recently for supporting Next.js, but so far it has mostly created issues. I will remove that banner from the esbuild config and cut a new release to make it work from the worker!
Using sdk with cloudflare workers in dev environment breaks
wrangler dev
.I am using:
I have
compatibility_flags = ["nodejs_compat"]
in my wrangler.toml fileI am getting the following error when running
wrangler dev
After digging into to my node_modules I found that the
node_modules/@codesandbox/sdk/dist/esm/index.edge.js
file has the following content:Where the const require is not used anywhere. When I commented it out and the code looked like this:
Then it's working correctly and I can use the sdk to create and interact with sandboxes. So,
import.meta.url
is not available. If I use require to import @codesandbox/sdk then it works correctly but I don't want to do that. Could someone look into it or tell me a workaround?Also would like to be sure if it is a config issue with cjs/esm :(
The text was updated successfully, but these errors were encountered: