-
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
Provide virtual input file system to .build() #690
Comments
This is an interesting idea, and is something that I assume would be far faster than a previous proposal you had somewhere for a file system API to essentially intercept |
I'm trying to develop an HTML as entry plugin, and I need the virtual file system too, especially for It calls When using However, for |
It would be nice to have an output virtual filesystem as well because we do some runtime/dynamic js bundling (esbuild's speed is an incredible fit for that). |
gulp use vinyl as virtual fs |
There are many use cases for virtual entries. I've used this feature in Webpack and Rollup many times for creating hydration scripts, dynamic entry points, Svelte components, etc. It would be great if there was a way to solve this with esbuild! |
Virtual entrypoints would help me avoid expensive read/writes to the filesystem for Svelte SSR components, which I'm only using to render to HTML and then discard. |
I've found writing to the file system to actually be more efficient than passing data through esbuild's IPC pipe, especially for large amounts of data. This is why esbuild's |
FYI, Go 1.21 will feature The target still has some issues being worked through for various runtimes, so hopefully by 1.21 it's stable. |
Just to clarify, is the feature being requested here conceptually similar to @rollup/plugin-virtual or have I misunderstood? |
I would say that @evanw has proven that a full virtual FS is achievable through https://esbuild.github.io/try/. A precedent for this was produced in https://github.com/esbuild/esbuild.github.io/blob/main/src/try/fs.ts but what I'd love to see is a bit more of an ergonomic approach / DX. I'd also love to see this sort of thing to:
|
That's not really indicitive of the effort needed to do this. The FS API used to achieve that playground page relies on the implementation detail that Go sticks its FS abstractions onto the globals when executed in the browser (https://github.com/golang/go/blob/master/misc/wasm/wasm_exec.js#L16), not that there's been any change internally within esbuild to allow a VFS anywhere other than the browser using this trick. The same goes for my WASI version; it's modifying the host, not esbuild. |
Description
Allow an initial partial filesystem seed to be provided as an input to a
.build()
operation.Use-case
In order to increase the common capabilities between the WASM-based and binary-based implementations, it would be helpful to have some measure of control over the filesystem. I thought that one potential avenue for this that would avoid expensive and complicated coordination between
esbuild
and the controlling system might be to allow an initial FS snapshot to be seeded.For my use-case, this would allow me to fully embrace
esbuild-wasm
and have platform and runtime environment portability.The text was updated successfully, but these errors were encountered: