8000 Core: Use named exports in `src/` · Issue #5262 · jquery/jquery · GitHub
[go: up one dir, main page]

Skip to content
Core: Use named exports in src/ #5262
Closed
@mgol

Description

@mgol

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0