Description
The code in src/ on the main branch is authored using ECMAScript modules with default exports. Each file exports a single API.
In the exports PR (#5255) for 4.0, a concern has been raised by @GeoffreyBooth that default exports are generally discouraged so we should ideally provide named jQuery & $ exports in addition, even if we keep the default export as well. There's a link to a Webpack docs page there that says:
Avoid the default export. It's handled differently between tooling. Only use named exports.
I just wondered how that affects our approach to jQuery source code. Since we plan to expose the ESM files from src/, should we switch them to use named exports as well?
If we switch, this is likely to affect our AMD output published to the amd directory. We can either accept it, or tweak the AMD output or maybe even give up on AMD for individual modules and just bet on ESM here.
Link to test case
N/A
Description
The code in
src/on themainbranch is authored using ECMAScript modules with default exports. Each file exports a single API.In the
exportsPR (#5255) for 4.0, a concern has been raised by @GeoffreyBooth that default exports are generally discouraged so we should ideally provide namedjQuery&$exports in addition, even if we keep the default export as well. There's a link to a Webpack docs page there that says:I just wondered how that affects our approach to jQuery source code. Since we plan to expose the ESM files from
src/, should we switch them to use named exports as well?If we switch, this is likely to affect our AMD output published to the
amddirectory. We can either accept it, or tweak the AMD output or maybe even give up on AMD for individual modules and just bet on ESM here.Link to test case
N/A