Skip to content

Rename cjs to node and es to frontend in dist, tsconfig and build scripts #3531

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

Closed
trivikr opened this issue Apr 11, 2022 · 3 comments
Closed
Labels
feature-request New feature or enhancement. May require GitHub community feedback.

Comments

@trivikr
Copy link
Member

trivikr commented Apr 11, 2022

Is your feature request related to a problem? Please describe.

As of 2022-04-11, we use cjs and es in dist, tsconfig and build scripts. This is an issue as we will likely provide ESM artifacts being discussed in #2900.

We haven't decided on whether to use ESM wrapper or Isolate State. It needs a deep dive, but we're likely to use ES Module wrapper using a tool like gen-esm-wrapper, as:

  • it doesn't significantly increase install size.
  • has less operational load as we don't have to manage additional configuration.

There can still be a confusion as browser+react-native artifacts in es can be considered as Node.js (ESM) artifacts.

Describe the solution you'd like

Do the following renames:

  • cjs to node
    • dist-cjs to dist-node
    • tsconfig.cjs.json to tsconfig.node.json
    • build:cjs to build:node
  • es to frontend
    • dist-es to dist-frontend
    • tsconfig.es.json to tsconfig.frontend.json
    • build:es to build:frontend

In future, when ESM artifacts are supported

  • ES Module wrapper: They can be added inside node
  • Isolate State: The node can be renamed to node-cjs, and ESM artifacts can be emitted inside node-esm or node-mjs

Describe alternatives you've considered

  • Rename es to frontend but retain cjs
  • Rename es to web because it's short. We didn't select this option, as backend technologies are also sometimes called web technologies.
  • Rename es to client as it's used on the client side. We didn't select this option, as it can be confused with service clients if we decide to make name public (like as a suffix in package name for specific variant: @aws-sdk/client-s3-client).
@trivikr trivikr added the feature-request New feature or enhancement. May require GitHub community feedback. label Apr 11, 2022
@trivikr trivikr changed the title Rename cjs to node-cjs and es to frontend in dist, tsconfig and build scripts Rename cjs to node and es to frontend in dist, tsconfig and build scripts Apr 11, 2022
@skyrpex
Copy link

skyrpex commented Apr 24, 2022

👋 I don't understand the renames. Currently, there's the bundle in CJS format and the bundle in ES(M) format. Both frontend and node can support CJS and ES modules (depending on the browser and the node version). I'm a bit confused if the renamed bundles will have additional differences.

@trivikr
Copy link
Member Author

trivikr commented Sep 14, 2022

No longer doing it, as we'll mostly emit Node.js under dist-esm.

@trivikr trivikr closed this as completed Sep 14, 2022
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request New feature or enhancement. May require GitHub community feedback.
Projects
None yet
Development

No branches or pull requests

2 participants