[WIP] Initial Sandpack Proof of Concept
This is my initial POC for Sandpack, it's reaaaally rough right now because I don't have more time today. One thing I'd like to do is wrap the existing CodeMirror panels in SandpackConsumers, because those are already styled perfectly. I'm also thinking of exposing the Error field on the Sandpack state.
Deploy preview for babel-new ready!
Built with commit b7924867e14fe677d7f5171b72e682fb4725881b
https://deploy-preview-1600--babel-new.netlify.com
Ah I went ahead and started to reuse the existing components, was simpler than I thought!
Dang it feels super fast!?
Dang it feels super fast!?
wow it's really super fast, Ives :heart_eyes:
There are some things that still need to be done and I could get help with:
- [x] Generate a
.babelrcbased on the sidebar state. - [ ] Add a File Explorer in the sidebar to view
.babelrcand/index.js. - [x] Remove the existing Babel worker.
- [x] Move things like File Size etc. over to the compiled code coming from Sandpack.
- [ ] In babel standalone, externalize
fs(in a special build) and exposeprocessOptionsasBabel.processOptions. This way we can usefsin Babel transpilation. - [ ] Add
Open in CodeSandboxbutton somewhere, the component for this is already exported bySandpack.
And these are some things that should still come to Sandpack, I can look at the first one today:
- [x] Add an
errorsarray field onmanagerState. - [x] Create a Babel template (I'll do this later).
If there's anyone interested in helping, I'd really appreciate it 😄. Just take something from the list of todos if you're interested!
I got the bundle from 3.2MB to 1.7MB.
I think we can still improve the bundle size, I believe that the Netlify build server doesn't have NODE_ENV=production, which causes the bundle to include source maps from emotion. If NODE_ENV=production we'll get a build that's 428KB (not gzipped).
If we do https://github.com/babel/website/pull/1483 or update to v7 you can use <> instead of React.Fragement altogether it's really not a big deal.
TODO items for me:
- [x] Generate
babel-transpiler.jsonbased on incoming query params to support previewing PRs, etc. - [ ] Fix 3rd party plugins loading
- [x] Fix eval
- [ ] Fix prettier
- [ ] Fix minifier
- [ ] Cleanup!!!