Open refi64 opened 7 years ago
polymerize will allow you to progressively load part of the applications while dart2js
builds would hardly support that and at the moment this is impossible for the very nature of tree-shaking.
This feature should in part be able to balance the lack of tree-shaking and in some cases could be even better.
Anyway we will be glad to support dart2js
as soon as some blocking feature will be unlocked, so this mostly depends on the dart team now.
The features we need to support dart2js
are : the support for up-to-date html standards (dart:html
is very old right now) and a more powerfull js-interop layer.
As soon as those blocking features will bel removed dart2js
will be a priority.
why not try deferred loading ?
It works fine for AngularDart !
import 'release_list_component.dart' deferred as release_list;
write-up by @matanlurey https://medium.com/@matanlurey/lazy-loading-with-angular-dart-14f58004f988
deferred
loading is not what we are looking for. It doesn't work for resources for instance and requires to have the library source code available.
dynamic loading leverages dartdevc
unique feature to split the code in separate indipendent modules allows for a more powerfull feature: it allows you to load thirdy party precompiled libraries.
you can for instance define a common API (interfaces, types, ecc.) to be shared between an host package and a plugin package (eventually developed by an unknown thirdy party) and let the host dynamically load the plugin and use it. this is not possible with deferred
libraries and never will be possible with dart2js
.
I know using DDC seems to be a big idea behind Polymerize, but, for production uses (I probably shouldn't be using this for product stuff yet anyway though...), dart2js's tree shaking is great, it's more stable, and being able to avoid using an ES6 transpiler is even better.
Is this planned to be done eventually?