Comments (12)
If we can get even just a single-file Astro compiler working in the browser, then I'm definitely going to start pushing for a browser REPL for public launch :)
from astro.
Would be nice if you can either take the file system as an object input or take a callback to retrieve files.
If we pull this off, you can embed components.studio as a REPL and walkthroughs.dev will also work.
from astro.
I think it's doable. At the moment the biggest issue is that we compile dependencies (both static and client dynamic) into URLs that only the Astro runtime understands. But I think it's probably possible to leave those alone. I'll take a crack at the idea this week, maybe in a branch, and see what you think.
from astro.
That would be very cool π
from astro.
I'd love to support an in-browser compiler, but a lot of how Astro works requires file system access. For example, if you import a React component, we need to load that component and render it to HTML.
In some ways, it would be like trying to deliver an in-browser compiler for Next.js.
from astro.
I don't think the compiler portion of Astro requires file system access. We don't render React/etc. components to HTML until execution. An Astro file compiles to a JavaScript module. That module contains imports to other modules (including framework components). If the runtime can resolve a bare specifier then it should be able to handle a compiled Astro file (I think I haven't looked deeply enough to confirm this).
from astro.
from astro.
https://play.astro.build could be very cool -- akin to https://play.tailwindcss.com
from astro.
https://play.astro.build could be very cool -- akin to https://play.tailwindcss.com
I'm a big fan of Svelte's REPL as well. It's even tied in to GitHub so you can save sessions as gists
from astro.
stackblitz webcontainers and next.js live look like very promising solutions concerning this feature request, although both of them will not satisfy all the requirements of astro right now.
from astro.
We've made some huge progress on this front! Will keep this issue open until all of this lands as stable, but...
https://github.com/snowpackjs/astro-compiler-next will be a stand-alone package published as @astrojs/compiler
and https://astro.build/play is running it in the browser!
from astro.
Awesome work @natemoo-re !!!
I feel like this is safe to close now, with work continuing in the https://github.com/snowpackjs/astro-compiler-next repo. We'll keep making improvements to the API as we get closer to v1.0. Cheers yall! π₯³
from astro.
Related Issues (20)
- @astrojs/rss uses trailing slash in urls when it shouldn't HOT 1
- Add a new `Astro.metadata` global object HOT 6
- SVG rendering error - "unsupported file type" HOT 2
- VIewTransitions break on presence of <input name="action"> HOT 2
- cannot dev or preview a page, if the page filename contain 'index', eg. e-index.astro HOT 2
- onTouchStart not being attached to DOM elements when using jsx HOT 8
- Rendering React component does not work HOT 4
- `@astrojs/mdx`: βsmart quotesβ are broken in HTML headers HOT 2
- React hydration error with react table but works fine the same example in next.js HOT 2
- ViewTransitions breaking Radix/Shadcn ui Dropdown Functionality in Astro App HOT 7
- Relative paths in css url() references get double encoded HOT 4
- @astro/node gcloud [ERROR] TypeError: Error: Unexpected end of multipart data HOT 4
- Astro DB on Cloudflare: Build fails with "Cannot create a remote client: missing app token" error. HOT 5
- Astro DB: push with --force-reset doesn't seem to work. HOT 2
- A command field in astro:config:setup returns build value while running check command HOT 3
- Astro DB: `astro preview` fails with "Cannot create a remote client: missing app token"
- Bun & Tailwind - Unexpected reading - node_modules/postcss-load-config/src/options.js HOT 3
- [View Transitions] Using client:only in dev causes page reloads on view transitions HOT 3
- @astrojs/mdx>=2 unnecessarily removes whitespaces and line breaks from multiline strings in Astro components props supplied from Remark HOT 1
- Toolbar audit incorrectly flagging images as above the fold HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astro.