aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

Remove "module" field from packages

Open trivikr opened this issue 2 years ago • 0 comments

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

We currently pass browser specific code in "module" field. This is a bad practice as it might affect tree shaking while bundling node-specific code.

Describe the solution you'd like

Since we do not generate ESM artifacts specific to Node.js (follow-up pending in https://github.com/aws/aws-sdk-js-v3/issues/3223), remove the "module" field from packages.

Describe alternatives you've considered

N/A

Additional context

  • From esbuild docs:

    For package authors: Some packages incorrectly use the module field for browser-specific code, leaving node-specific code for the main field. This is probably because node ignores the module field and people typically only use bundlers for browser-specific code. However, bundling node-specific code is valuable too (e.g. it decreases download and boot time) and packages that put browser-specific code in module prevent bundlers from being able to do tree shaking effectively. If you are trying to publish browser-specific code in a package, use the browser field instead.

  • StackOverflow: https://stackoverflow.com/questions/42708484

trivikr avatar Apr 08 '22 22:04 trivikr