Alternative Approaches

Here is a precise comparison between the alternative approaches that have been practised over the years.

Comparison Table

Publishing Legacy Code

Publishing Modern Code

Publishing Compiled Code

Publishing Editions

Published source code

Yes

Yes

No

Yes

Published compiled code

No

No

Yes

Yes

Source and compiled code is published

No

No

Yes, however is difficult and non-standardised

Yes

Producers can make use of modern features (e.g. esnext, babel)

No

Yes, however at the cost of environments that don’t support those features

Yes

Yes

Consumers can make use of modern features (e.g. es modules, flow type)

No

Yes, however at the cost of consumers that don’t support those features

Yes, however is difficult and non-standardised

Yes

Consumption always runs latest compatible code

No, legacy code always used, even on modern environments

No, modern code may not be compatible with legacy environments

Yes, however is difficult and non-standardised

Yes, loaders can automatically load appropriate edition for target environment

Legacy bloat consumed on modern environments

Yes

No

No, however is difficult and non-standardised

No

Modern features could break legacy consumption

No

Yes

No

No

Fixing legacy consumption breaks is easy

No, likely requires manual code changes or polyfill

No, likely requires code rewrite or compilation

Yes, change is a compiler flag

Yes, change is a compiler flag

Consumers informed about this

Yes, however is difficult and non-standardised

Yes, however is difficult and non-standardised

Yes, however is difficult and non-standardised

Yes, renderers automatically inform consumers of their options

Last updated