aws-sdk-js-v3
aws-sdk-js-v3 copied to clipboard
Remove "module" field from packages
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 themodule
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 inmodule
prevent bundlers from being able to do tree shaking effectively. If you are trying to publish browser-specific code in a package, use thebrowser
field instead. - StackOverflow: https://stackoverflow.com/questions/42708484