Can we run sucrase in the browser like babel-standalone?
See original GitHub issueFor the same reasons babel-standalone exists. Would be nice to be able to run sucrase in browser code.
e.g.
<div id="root"></div>
<script src="https://unpkg.com/.../sucrase.js"></script>
<script type="text/sucrase" src="app.js"></script>
Right now babel-standalone doesn’t support React Fragments (it’s stuck on babel v7 beta 3).
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:14 (3 by maintainers)
Top Results From Across the Web
Comparing Babel, Sucrase, and Similar Libraries
Babel compiles all your code down to what your browser can run, while Sucrase focuses on a small portion of what Babel does....
Read more >Can we run sucrase in the browser like babel-standalone?
For the same reasons babel-standalone exists. Would be nice to be able to run sucrase in browser code. e.g.
Read more >babel/standalone
babel /standalone provides a standalone build of Babel for use in browsers and other non-Node.js environments.
Read more >Emscripten vs Sucrase | What are the differences? - StackShare
Sucrase is an alternative to Babel that allows super-fast development builds. Instead of compiling a large range of JS features down to ES5,...
Read more >Sucrase, a Faster Babel for Modern JS Runtimes - InfoQ
You should think carefully before using Sucrase in production. Sucrase is mostly beneficial in development, and in many cases, Babel or tsc will ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’ll be nice if Sucrase could include a UMD or IIFE version in release. Then we’ll be able to use it directly via
importScripts
in Service Workers.I’m writing an on-the-fly build tool using Service Worker, whose goal is to rid of node completely for modern frontend development/production, and I’m finding an alternative to esbuild since it could go out of stack strangely in Safari, but lacking of UMD/IIFE support won’t make me able to create a plugin for Sucrase.
Currently there’s only a CJS version and https://bundle.run/sucrase could do nothing about it.
Here an example on how you can setup sucrase to work in the browser using a service worker: https://gist.github.com/nestarz/dcaa70b5ecac5fa7e66103658f7ff0b7
The caveat is that I copied paste the code (from skypack) of sucrase inside the sw.js.