(fluent.js) Removing compat.js builds, targeting ES2018 by default

As part of the build system clean-up in fluent.js, I intend to make changes to the build artifacts produced for @fluent packages.

Currently, the build artifacts for each @fluent package are:

  • Individual JS files in esm/ using ES modules transpiled from TS to ES2019,
  • index.js in the package directory, bundled with Rollup from the files in esm/ ,
  • compat.js in the package directory, bundled with Rollup from the files in esm/ and transpiled to ES2017, roughly.

In #472 I’ve suggested to change the build artifacts to:

  • Individual JS files in esm/ using ES modules transpiled from TS to ES2018,
  • index.cjs in the package directory, bundled with Rollup from the files in esm/ .

Note the change from ES2019 to ES2018, as well as the removal of compat.js. ES2018 code will be the only code shipped in @fluent packages.

The hypothesis behind this change is that consuming projects usually already have their own transpilation pipelines to ensure the best compatibility for their users. The idea to ship a transpiled version of our code as compat.js comes from 2016/17 when ES2015 support still wasn’t common, and when some build tools struggled to parse it. Today, my hope is that for the most part these are the problems of the past.

I plan to implement the above changes next week. Please share your feedback here or in #472. Thanks!