question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use Sucrase for faster builds

See original GitHub issue

Clear and concise description of the problem

I’ve been using Vite for about 2 months now and I must say I’m in love with it.

I’m also developing mobile apps using React Native and Expo, and after upgrading Expo to SDK to its latest version I realized my building time has dropped from ~1:43 to just ~1:00 on a mid-size app (apart from reducing the app size from 92 to 74MB).

There’s no right or wrong here, but I believe it could be an improvement for faster builds at least during development by using sucrase instead of TS as a compiler.

More on how/why Expo uses Sucrase for building here.

Suggested solution

Create an experiment by using sucrase for compilation of node_modules with @rollup/plugin-sucrase and benchmarking it to see results for both build time* and potentially bundle size** on different projects of mid and large sizes.


  • * The primary goal would be measuring the build time itself and see if it is possible to reduce it by 10% at least.
  • ** A secondary and equally interesting goal would be measuring the possibility of smaller bundle sizes.

    Note: I’ll start experimentations using Sucrase instead only for node_modules and see not only if it reduces the building time, but also guarantee that nothing will be broken.

    Alternative

    No response

    Additional context

    No response

    Validations

  • Issue Analytics

    • State:closed
    • Created 2 years ago
    • Comments:5 (3 by maintainers)

    github_iconTop GitHub Comments

    1reaction
    bluwycommented, Dec 12, 2021

    Sucrase seems to be partially forked from babel, and the closest rust-alternative to babel is swc. swc has been brought up from time to time to replace some of the babel usage of vite plugins as well. Maybe one day VIte would use it as well.

    I’ll close this for now since it seems unlikely that this would happen soon. But feel free to experiment it with Vite if you wish.

    0reactions
    mdbetancourtcommented, Dec 12, 2021

    yes i think so (about is not a perfect fit for vite), sucrase has a lot of limitations esbuild is likely more future proof, i just point out sucrase it’s faster (since split transpilation work across threads is so trivial even if sucrase is single-threaded)

    i’m so curious about how faster sucrase could be if is build using a compiled language as rust 🤔

    Read more comments on GitHub >

    github_iconTop Results From Across the Web

    Sucrase, a Faster Babel for Modern JS Runtimes - InfoQ
    The Sucrase JavaScript/TypeScript compiler aims at providing significantly faster development builds than the standard Babel compiler.
    Read more >
    Comparing Babel, Sucrase, and Similar Libraries
    Sucrase is a super-fast potential alternative to Babel that allows faster development builds. It claims to be about 20x faster than Babel.
    Read more >
    Sucrase, 20x faster smaller-scoped alternative to Babel
    I've done a little prototyping on using a Sucrase-like approach to speed up webpack (most of it is indeed parse time), but it...
    Read more >
    sucrase - npm
    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 rivals Babel JavaScript compiler for development use
    Not recommended for production, Sucrase trades the scope and flexibility of Babel for faster builds during development.
    Read more >

    github_iconTop Related Medium Post

    No results found

    github_iconTop Related StackOverflow Question

    No results found

    github_iconTroubleshoot Live Code

    Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
    Start Free

    github_iconTop Related Reddit Thread

    No results found

    github_iconTop Related Hackernoon Post

    No results found

    github_iconTop Related Tweet

    No results found

    github_iconTop Related Dev.to Post

    No results found

    github_iconTop Related Hashnode Post

    No results found