You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There was a time when I thought default exports are succinct. However, they introduce insidious problems. It will be dangerous to mix named and default exports in our codebase after #1077.
Interoperability. Module systems apply different constraints and semantics. For example, CommonJS exports and module.exports are incompatible with ECMAScript export default. A real-world case is our hard time with highlight.js.
Maintainability. Default exports make it much harder to find references, due to implicit name conversion and inconsistent import pattern. See Google's rationale.
The text was updated successfully, but these errors were encountered:
Proposal
Convert default exports to named exports.
Avoid default exports in future.
Background
There was a time when I thought default exports are succinct. However, they introduce insidious problems. It will be dangerous to mix named and default exports in our codebase after #1077.
Interoperability. Module systems apply different constraints and semantics. For example, CommonJS
exports
andmodule.exports
are incompatible with ECMAScriptexport default
. A real-world case is our hard time withhighlight.js
.Maintainability. Default exports make it much harder to find references, due to implicit name conversion and inconsistent import pattern. See Google's rationale.
The text was updated successfully, but these errors were encountered: