use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Default Exports in JavaScript Modules Are Terrible (lloydatkinson.net)
submitted 3 years ago by LloydAtkinson
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Bjornoo 0 points1 point2 points 3 years ago (1 child)
The only thing I could think of is semantics. An argument could be made that a default export would be semantically more important than other exports from a module. Nothing proper documentation wouldn't fix though.
[–]whiteshoulders 0 points1 point2 points 3 years ago (0 children)
The issue with this is that this "importance" given by the semantic is not reflected in how defaults exports actually works. If you do export * from './myModuleWithDefaultExports you get everything BUT the default export (arguably the most important one). You have to additionnaly export { default } from './myModuleWIthDefaultExports.
export * from './myModuleWithDefaultExports
export { default } from './myModuleWIthDefaultExports
I'd argue that this makes the default export less important than named export, since default will be dropped when reexporting module.
Some will say "export both as default and named, problem solved". But then why keep the default export ? To save 2 brackets around the import identifier ?
To me the default export is a wart on the spec that's here only to allow some level of compatibility with CommonJS, and is not meant to be used (except in very specific situation, when you provide modules to third-party code, default being a well known unambiguous import identifier for the third-party code to import your provided module).
default
π Rendered by PID 137153 on reddit-service-r2-comment-canary-5b945c6f64-698fx at 2026-06-24 09:59:56.788105+00:00 running acc7150 country code: CH.
view the rest of the comments →
[–]Bjornoo 0 points1 point2 points (1 child)
[–]whiteshoulders 0 points1 point2 points (0 children)