This fork is mainly to adapt to Tango and work as its sandbox engine, so most of the modifications are focused on Sandpack.
yarn install
yarn build:deps
yarn build:sandpack
Built files will be in www/
.
Once built, use Caddy to serve static files. A Caddyfile
is already in the repo.
Or you can download prebuild assets from releases and Caddyfile
manually. Create a folder www
next to Caddyfile
, extract compressed tarball into www/
, and run Caddy.
caddy run
Or you can use Docker to build and deploy.
docker build -t tango-codesandbox .
docker run -p 8080:8080 tango-codesandbox
Tango and Sandpack requires to be run in HTTPS. If you want to test locally, assign any domain in your hosts file and resolve to 127.0.0.1
, then change Caddyfile
and replace :8080
to the domain. Once you've done, Caddy should be run on 8443
with self-signed HTTPS.
docker run -p 8443:8443 tango-codesandbox
Here are the main modifications applied in this fork, to make it run more flawless with Tango.
- Set
document.domain
to Second-level Domain, to make sure Tango can listen to fired events in iframe.- This requires to add
Origin-Agent-Cluster: ?0
response header for Chrome 115.
- This requires to add
- Force running Babel in multi-thread mode.
- Sandbox config is now in
sandbox.config.json
rather thanpackage.json
. - Resolve alias for ESM, and can be set as
alias
insandbox.config.json
. - Support externals feature like webpack, and can be set as
externals
andexternalResources
insandbox.config.json
. - Support passing
evaluateJavaScript
to run at head, and can be set insandbox.config.json
. sandboxId
can be set insandbox.config.json
- Support less module (
.module.less
)
Β
An instantly ready, full-featured online IDE for web development on any device with a browser. Enabling you to start new projects quickly and prototype rapidly. With CodeSandbox, you can create web apps, experiment with code, test ideas, and share creations easily.
CodeSandbox consists of several separate servers, some of which are open sourced.
- Client: the web application
- Server: the Phoenix API server
- Nginx: Nginx config files
- Git Extractor: responsible for extracting the source from a GitHub repository
- CLI: the CLI to upload a CodeSandbox project from your command line
You can find our documentation on our website
Thanks goes to these wonderful people (emoji key):
Thanks to Chromatic for providing the visual testing platform that helps us catch unexpected changes.