-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deno-esbuild: Deno Deploy support #2336
Comments
You can read the source code here: Lines 83 to 117 in 20f4b45
This will fail on Linux if certain environment variables aren't set. I don't use Deno and know nothing about it so I can't help you, sorry. |
Thanks for your reply @evanw ❤️. I'll look into this soon. |
BTW if you are ok with using WebAssembly instead of native, then you can try that when the next version of esbuild is released soon. See #2323 which was just fixed. |
Marking as |
Update: Deno Deploy does not support So my proposal is that we make This would allow building in Deno Deploy 🦕, and in the browser 🌐! You mentioned in #2323 that to get this working it would require additional work, so I am not expecting this to happen and just proposing it. Maybe I could even learn Go and do it myself. And maybe esbuild switching automatically to WebAssembly in Deno Deploy, but I don't think that's necessary since you can just check for the existence of What do you think? Do I write a new issue for this? |
I'm confused. The import * as esbuild from 'https://deno.land/x/esbuild@v0.14.48/wasm.js'
const result = await esbuild.build({
stdin: {
contents: `
import x from 'fib(10)'
console.log('fib(10) is', x)
`,
},
bundle: true,
plugins: [{
name: 'some-plugin',
setup(build) {
build.onResolve({ filter: /^fib\((\d+)\)/ }, args => {
return { path: args.path, namespace: 'fib' }
})
build.onLoad({ filter: /^fib\((\d+)\)/, namespace: 'fib' }, args => {
let match = /^fib\((\d+)\)/.exec(args.path), n = +match[1]
let contents = n < 2 ? `export default ${n}` : `
import n1 from 'fib(${n - 1}) ${args.path}'
import n2 from 'fib(${n - 2}) ${args.path}'
export default n1 + n2`
return { contents }
})
},
}],
})
eval(result.outputFiles[0].text)
Deno.exit(0) That should print this:
You'll need to use an esbuild plugin to avoid the file system if Deno Deploy doesn't have a file system, but there should be nothing preventing you from using esbuild in that case. I'm not planning on testing esbuild with Deno Deploy myself because it's a closed service so it'll be up to you to figure out how to write the plugin you need for this. I'm closing this issue since esbuild's current WebAssembly implementation should be sufficient for this. |
Deno Deploy is an edge runtime by Deno. And it would be awesome to use esbuild with it, but when I try to run this code:
It gives me this error:
I don't get the error right now, but I can try to find the problem and then propose a fix.
The text was updated successfully, but these errors were encountered: