tramvai icon indicating copy to clipboard operation
tramvai copied to clipboard

Have you considered building via ebuild or swc?

Open polRk opened this issue 2 years ago • 4 comments

polRk avatar Aug 02 '22 13:08 polRk

Hello!

About code transpiling, we have a two targets:

  • babel as default transpiler
  • swc as experimental transpiler

At this moment, unfortunately you can't use swc transpiler, because of our File-system routing depends on loadable-components babel plugin. There is no official swc plugin - https://github.com/gregberge/loadable-components/issues/529, exists only custom Next.js implementation.

Our future plans, when swc plugin system will be more stable (e.g. https://github.com/swc-project/swc/issues/2175 problem will be solved), to convert our important babel plugin to swc and present this loader officially.

SuperOleg39 avatar Aug 03 '22 09:08 SuperOleg39

About bundling, we also have a two targets:

  • webpack as default bundler
  • vite as alternative

But unlike swc case, we have no implementation with vite. For today, we just completed some preparation to made our @tramvai/cli bundler-agnostic.

SuperOleg39 avatar Aug 03 '22 09:08 SuperOleg39

@SuperOleg39 I like vite, can u provide an example?

polRk avatar Aug 03 '22 09:08 polRk

We don't have examples, only ticket in our backlog)

As a preparation, webpack was separated to builder abstraction - https://github.com/Tinkoff/tramvai/tree/main/packages/cli/src/builder/webpack, this is all what we have at this moment.

SuperOleg39 avatar Aug 03 '22 09:08 SuperOleg39

There is no official swc plugin - https://github.com/gregberge/loadable-components/issues/529, exists only custom Next.js implementation.

It's not a custom next.js implementation. Next.js doesn't do anything new to SWC per se, it's just that that plugin is packaged inside a next.js repository, nothing else.

It's even published on npm and available for download and usage.

https://npmjs.com/package/@swc/plugin-loadable-components

Drevoed avatar Dec 01 '22 12:12 Drevoed

Oh, I did not look at the dates 😄

Pardon me

Drevoed avatar Dec 01 '22 12:12 Drevoed

Yes, @swc/plugin-loadable-components is new and shiny)

Anyway, next has their own plugin - https://github.com/vercel/next.js/blob/canary/packages/next-swc/crates/core/src/next_dynamic.rs - port of Babel version, which was fork of loadable Babel plugin))

Soon we will finish our swc integration, and already fork this new @swc/plugin-loadable-components - https://github.com/Tinkoff/tramvai/tree/main/packages/swc/plugins/lazy_component

SuperOleg39 avatar Dec 05 '22 13:12 SuperOleg39

Full swc support is finished, and last changes shipped in v2.49.3 version!

After enabling swc loader, cold start for develompent build will be improved significantly.

Warm start and rebuild have a some small improvements, because of webpack@5 file-system caches

SuperOleg39 avatar Dec 12 '22 09:12 SuperOleg39