fusionjs / fusion-cli

Migrated to https://github.com/fusionjs/fusionjs
MIT License
140 stars 37 forks source link

Modern bundles for modern browsers #426

Open ksheedlo opened 6 years ago

ksheedlo commented 6 years ago

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.

gaurav- commented 6 years ago

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:

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