Skip to content

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

Closed
@trivikr

Description

@trivikr

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestNew feature or enhancement. May require GitHub community feedback.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions