react-runner icon indicating copy to clipboard operation
react-runner copied to clipboard

react-runner-with-swc (Need to create a new branch)

Open Mrxyy opened this issue 2 years ago • 6 comments

  • You can compile the code to ES5

Mrxyy avatar Jul 06 '23 07:07 Mrxyy

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
playground ❌ Failed (Inspect) Jan 5, 2024 4:46pm
react-runner ❌ Failed (Inspect) Jan 5, 2024 4:46pm
react-runner-codemirror ❌ Failed (Inspect) Jan 5, 2024 4:46pm

vercel[bot] avatar Jul 06 '23 07:07 vercel[bot]

what's the motivation?

nihgwu avatar Jul 06 '23 22:07 nihgwu

SWC can compile lower-level code to support more browsers.

Mrxyy avatar Jul 07 '23 07:07 Mrxyy

This package supports modern browsers(ES6), don't think WASM has broader support, and we use sucrase instead of Babel for smaller bundle size, I believe SWC will bloat it a lot(although it's loaded separately), and sucrase is already fast enough and maybe faster than swc in this case because of runtime of WASM

nihgwu avatar Jul 07 '23 11:07 nihgwu

This package supports modern browsers(ES6), don't think WASM has broader support, and we use sucrase instead of Babel for smaller bundle size, I believe SWC will bloat it a lot(although it's loaded separately), and sucrase is already fast enough and maybe faster than swc in this case because of runtime of WASM

My use case is as follows: I created a custom component on our low-code platform in the modern browser environment of the canvas editing mode. However, when the application is actually deployed, there is no code compilation process and instead it uses the previously compiled results.

Mrxyy avatar Jul 07 '23 16:07 Mrxyy

This package supports modern browsers(ES6), don't think WASM has broader support, and we use sucrase instead of Babel for smaller bundle size, I believe SWC will bloat it a lot(although it's loaded separately), and sucrase is already fast enough and maybe faster than swc in this case because of runtime of WASM

My use case is as follows: I created a custom component on our low-code platform in the modern browser environment of the canvas editing mode. However, when the application is actually deployed, there is no code compilation process and instead it uses the previously compiled results.

It is indeed inappropriate to do so when running in a browser. Some popular grammar can be supported in SWC. .e.g: https://github.com/alangpierce/sucrase#unsupported-syntax

Mrxyy avatar Jul 07 '23 17:07 Mrxyy