fusion-cli icon indicating copy to clipboard operation
fusion-cli copied to clipboard

Modern bundles for modern browsers

Open ksheedlo opened this issue 6 years ago • 1 comments

Type of issue

Feature request

Description

It would be cool if, instead of compiling all ES6 class syntax, async/await etc to ES5, Fusion could detect modern browsers that support these features and send them a more optimized bundle. For instance, class syntax doesn't need to be compiled into functions and prototypes anymore. This could significantly reduce the size of bundles sent to browsers that support modern features, since code volume generally goes up to support the newer syntax in the legacy environment.

Rel #34

Current behavior

Fusion delivers code to all browsers using the same compiler settings.

Desired behavior

Fusion delivers code to modern browsers using more aggressive compiler settings that allow browsers to provide their own class syntax and other ES6 features. Fusion still delivers the same transpiled and polyfilled code to legacy browsers.

ksheedlo avatar Jul 11 '18 01:07 ksheedlo

Meteor is probably the first ~(and so far the only one?)~ framework to do this properly. Some resources on how this is implemented in Meteor:

  • https://github.com/meteor/meteor/blob/devel/History.md#v17-2018-05-28
  • https://www.youtube.com/watch?v=vpCotlPieIY&index=4&list=PLTUf4ytkmI8QOopcigiv_dsIubylmfTsX&t=802s
  • https://blog.meteor.com/meteor-1-7-and-the-evergreen-dream-a8c1270b0901

Edit: Looks like Vue has also implemented this: https://github.com/vuejs/vue-cli/issues/1465

gaurav- avatar Aug 03 '18 12:08 gaurav-