DEV Community

loading...

Discussion on: Why I've stopped exporting defaults from my JavaScript modules

Collapse
rhymes profile image
rhymes

Hi Nicholas, nice explanation. Intuitively I've never fully understood "default exports" (coming from languages that don't have them). I remember than in the first app I wrote I spent way too much time thinking "should this module have a default export?".

Conventions have value but I feel default exports only add cognitive load to the module user :)

Also, if something like deno's import from URL ever takes on I'm not sure how default export are just going to be anything but a nuisance.

As you said:

I find it difficult to figure out what I'm importing when a module only has a default import.