One kilobyte of JS is enough to make a decoupled FE block in Drupal. And no Babels required!
One kilobyte of JS is enough to make a decoupled FE block in Drupal. And no Babels required!
To make a Drupal website modern we usually bring there interactive frontend components in JavaScript.
But not only just components!
Together with them, we have to bring a couple of more things:
- A pretty heavy framework: React, Angular, Vue, etc.
- Typescript transpiled to JavaScript.
- Something like Babel to pack all your JS dependencies into one large bundle.
- Rebuild the whole bundle after every change in any TS file!
And, suddenly, to display a simple frontend component, your Drupal webpage should download and execute hundreds of kilobytes, or even megabytes of large JS bundles!
What if I tell you, that you can simply get rid of all these, and just write a kilobyte of a pure and compact JS code? And with no dependency on any JS framework!
So, come and see how it works!