GithubHelp home page GithubHelp logo

Comments (2)

paulocfjunior avatar paulocfjunior commented on June 15, 2024 2

Findings

Currently, when using swc for typescript projects, we are still required to run tsc to generate the .d.ts files. This is the most time-consuming part of the build (taking around 40 sec to finish). The swc compiler takes only half a second to finish.

ℹī¸ Our current build structure takes 110 seconds to generate the dist folder.

swc is planning to generate the .d.ts files by itself as it's mentioned in this article (and this issue) which will allow users to get rid of tsc. It will also be able to bundle the files, so it may replace rollup itself.

On the other hand, the Typescript team seems to be aware that there's room to improve the tsc building/type-checking speed, they just don't seem to prioritize that right now, but there's a possibility that they do something about it in the future.

Test results

I was able to build the lib using swc + tsc.

Screen Shot 2022-04-08 at 01 03 21

The whole process took 45s.

Caveat

SWC doesn't seem to support Tree Shaking right now (detected by inspecting the .next dir of the target app), and it's a mandatory point to allow us to go forward on it, once we currently have this optimization.

According to the swc project it should be implemented (ref 1, ref 2 - via spack), but this package doesn't exist at this moment (IDK if existed already or if it's still to be done).

Conclusion

From here, we should:

  • Keep the current build structure (maybe just upgrade the libs used) and wait for swc to be ready to support Tree Shaking and generate .d.ts files.
  • Use combination of swc + tsc to have the build working 2,5x faster, having in mind that swc is under heavy development.

from faency.

seedy avatar seedy commented on June 15, 2024

Closing with conclusions validated

from faency.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.