Skip to content
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

Consider migrating AMP's infrastructure code to ES6 #36201

Open
rsimha opened this issue Sep 29, 2021 · 2 comments
Open

Consider migrating AMP's infrastructure code to ES6 #36201

rsimha opened this issue Sep 29, 2021 · 2 comments
Labels
Stale Inactive for one year or more Type: Feature Request WG: infra

Comments

@rsimha
Copy link
Contributor

rsimha commented Sep 29, 2021

Description

AMP's infrastructure code in build-system/ is currently all ES5 and uses require to consume various packages. However, more and more packages are switching to ES6-only, and cannot be adopted in their current form. E.g. node-fetch and tempy (there are a few others, see #35032 (comment)).

Migrating all code in build-system/ to ES6 will modernize the codebase and solve the problem of not being able to use the latest version of some packages. However, the actual difficulty of doing this is unknown, since other packages may be ES5-only, and existing task implementations may need updates before they can work cleanly with ES6 packages.

The purpose of this issue is to discuss / experiment with a partial migration, and make a recommendation on how to proceed.

Alternatives Considered

  1. Remain on ES5 and don't adopt the latest version of any ES6-only package
  2. Partially move to ES6 and migrate only those tasks that can actually work with ES6-only packages
  3. Fully move to ES6 and find replacements for any ES5-only packages

1 is not future-proof, 2 can be done gradually (assuming it's possible), and eventually lead to 3.

Additional Context

/cc @ampproject/wg-infra @ampproject/wg-performance @ampproject/wg-components @ampproject/wg-bento

@samouri
Copy link
Member

samouri commented Sep 29, 2021

may be ES5-only, and existing task implementations may need updates before they can work cleanly with ES6 packages.

I believe ES5-only packages are usable via import syntax. See the Node docs

When importing CommonJS modules, the module.exports object is provided as the default export. Named exports may be available, provided by static analysis as a convenience for better ecosystem compatibility.

@stale
Copy link

stale bot commented Sep 28, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Inactive for one year or more label Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Inactive for one year or more Type: Feature Request WG: infra
Projects
None yet
Development

No branches or pull requests

2 participants