newsuk/times-components

bundle: esm for tree shaking

craigbilner opened this issue · 0 comments

Do you want to request a feature or report a bug?

feature

What is the current behaviour?

We bundle to commonjs and then stitch together at the end which doesn't allow for tree shaking across the whole code base

What is the expected behaviour?

We create esm bundles as well as commonjs bundles. Commonjs can be used on the server to remove the perf overhead on nodejs and esm can be used for client-side/native bundling which should result in smaller bundles

If this is a feature request, what is the motivation or use case for changing
the behaviour?

Smaller bundles === better customer experience