Skip to content
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

Support global instance of a WASM binary vs wasmURL reference (for say Cloudflare Worker environments) #1093

Closed
whatnickcodes opened this issue Mar 31, 2021 · 2 comments · Fixed by #2155

Comments

@whatnickcodes
Copy link

whatnickcodes commented Mar 31, 2021

I apologize in advance will be a noob. Love this project.

Currently:

esbuild.initialize({ wasmURL:

Would be nice to have this option or similar:

const esbuild = new WebAssembly.Instance( ESBUILD_WASM

Where ESBUILD_WASM is a global variable.

Why?
Beside achieving a REPL, some environments like Cloudflare Workers require the WASM binary to be created this way due to needing to be a Resource Binding.

For fun / experiment...
Have an idea for a brand new way to build apps as fun experiment. If a person can get esbuild jammed in a Cloudflare worker through the WASM binary, you could on each request render a bunch of code, combine a bunch of virtual esmodules (ideally tree shaked, minified, uglified) and output the result. Would be trivial to cache the output, but by leveraging WASM and esbuild, it might be so quick a normal user wouldn’t even know even for complex pages.

Almost like a single simple PHP template file but the output of the JS, HTML, CSS is stripped to absolute nakedness form. Would also allow remote/db driven components on the fly for a route.

@whatnickcodes
Copy link
Author

@okikio
Copy link

okikio commented Apr 6, 2022

@whatnickcodes The fetching, bundling, treeshaking, minifing, etc... can be done locally in browser via https://bundle.js.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants