-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove compat.js build artifacts #472
Comments
Here's the summary of the changes between the
|
I should also add that while the above summary compares the outputs of TypeScript transpilation with different |
compat.js
build artifacts
ES2018 sounds good to me, and I agree with the storyline about moving compat processing to older browsers to the pipelines of the consuming projects. |
Our build process produces the following files for each
@fluent
package:esm/
using ES modules transpiled from TS to ES2019,index.js
in the package directory, bundled with Rollup from the files inesm/
,compat.js
in the package directory, bundled with Rollup from the files inesm/
and transpiled using Babel andpreset-env
.The configuration for
preset-env
is defined inbabel_config.js
. The way I defined it was a bit backwards, however. It wasn't that we really needed to support these browser versions. Instead, we settled on supporting all browsers which supported async functions. In other words, the configuration ofpreset-env
emulates the now-obsoletepreset-es2017
.With the migration of
@fluent
packages to TypeScript, we could also usetsconfig
'starget
field to perform a similar version-based transpilation. We currently transpile to ES2019, but we could it run it again and transpile to ES2017, and get rid of Babel completely.Furthermore, I've investigated what the differences between ES2017 and ES2019 are, on the assumption that perhaps we could just transpile to one version and completly remove the
compat
artifacts from our build system. The changes are not significant, I'll post a summary in a comment.This idea is motivated by three circumstances:
compat
builds are rarily needed any more. I came up with this solution a long time ago when build systems didn't support transpilingnode_modules
dependencies. Today, my understanding is that Webpack and other tools take care of that automatically, and if they don't, it's easy to configure them to do so.@fluent/PACKAGE/compat
, you lose the automatic typing discovery in IDEs like VS Code. This is because the typings are in theesm
directory and they map to symbols imported from@fluent/PACKAGE
. See Missing types for compat in fluent-react #456.@fluent/react
which depends on@fluent/sequence
, we need a piece of extra build logic which makes it such that@fluent/react
imports from@fluent/sequence
, but@fluent/react/compat
imports from@fluent/sequence/compat
.The text was updated successfully, but these errors were encountered: