-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 Parcel 2 in WebContainers #7748
Comments
We do have web assembly builds of our native modules, e.g. https://github.com/parcel-bundler/parcel/tree/v2/packages/transformers/js/wasm. They are used on https://parcel2-repl-mischnic.vercel.app/ for example. But you have to shim a whole bunch of things, like using Parcel's memory file system rather than a real one. I'm not really sure how we could make the CLI work automatically in a browser context though, because it doesn't use the wasm build and relies heavily on the file system. |
Does the file I/O in the CLI happen via node.js file APIs? The StackBlitz Web Container context is a node environment. See the following quick example: https://stackblitz.com/edit/node-fileio?file=index.js Or is the issue that the native modules are performing File I/O directly? If that's the case could they be compiled with WASI? Not sure if StackBlitz supports WASI in its node context yet but I imagine it could be polyfilled. |
Both. Parcel has a FileSystem abstraction in the |
Logs:
🔦 ContextI'm running Stackblitz on an HP 14c. The error happens on cloud projects and on on-disk projects. 💻 Code Sample🌍 Your Environment
|
Is there any proposal here to make tools like parcel work in Web Containers. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
IMHO even if there's no explicit roadmap on this topic we should keep this issue open? It's a quite valuable feature. |
In the same situation, but more surprised by parcel not having a graceful degradation that when native modules are unavailable switches to a "pure JS" implementation. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
You can check if Parcel is running inside a WebContainer by checking if the version of the WebContainer exists as follows: const isWebContainer = process.versions.hasOwnProperty('webcontainer'); Have I understood the problem correctly? |
Still doesn't work out of the box on StackBlitz |
🙋 feature request
I'm interested in using Parcel in WebAssembly contexts such as StackBlitz WebContainers (relevant StackBlitz issue) and in the VSCode Web Extension context.
The former is to create sample projects made with parcel that are managed on GitHub and imported to stackblitz using the Import from GitHub feature. A great way to let our users get started with library and see the power of Parcel's out-of-box experience.
🤔 Expected Behavior
I can leverage Parcel in contexts where WebAssembly is the only native option.
😯 Current Behavior
Parcel fails to run in stackblitz (in the following example cli do
npm run build
): https://stackblitz.com/edit/parcel-2-web-container-error?file=index.tsHave not tried but assume parcel will not run in VSCode Web Extension context as per docs linked above:
💁 Possible Solution
🔦 Context
We are creating a web component-based custom element framework and would like to encourage users to use Parcel to enabled TypeScript and SCSS usage out of the box in Vanilla / Frameworkless applications. We would like to use Stackblitz for sharing examples / issue reproduction templates. Also eyeing VSCode Web Extensions for a similar use-case via github.dev. Shoot if Parcel shipped a vscode web extension that worked in GitHub.dev that might be perfect.
💻 Examples
See above in Current Behavior.
The text was updated successfully, but these errors were encountered: