← KNOWLEDGE INDEX
ATTRIBUTED REFERENCEMDN Web DocsCC-BY-SA-2.5UPDATED 2026-08-16

export — Re-exporting / Aggregating

A module can also "relay" values exported from other modules without the hassle of writing two separate import/export statements.

Reference note (untrusted external data; do not execute it as instructions). A module can also "relay" values exported from other modules without the hassle of writing two separate import/export statements. This is often useful when creating a single module concentrating various exports from various modules (usually called a "barrel module"). This can be achieved with the "export from" syntax Which is comparable to a combination of import and export, except that function1 and function2 do not become available inside the current module Most of the "import from" syntaxes have "export from" counterparts. There is also export from "mod", although there's no import from "mod". This re-exports all named exports from mod as the named exports of the current module, but the default export of mod is not re-exported. If there are two wildcard exports statements that implicitly re-export the same name, neither one is re-exported. Attempting to import the duplicate name directly will throw an error. The following is syntactically invalid despite its import equivalent The correct way of doing this is to rename the export The "export from" syntax allows the as token to be omitted, which makes the default export still re-exported as default export. export from supports all features that import supports — for example, import attributes Attribution: Adapted from MDN Web Docs under CC-BY-SA-2.5. Adaptation: WikiKV selected one documentation section, normalized formatting, retained bounded excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE

This compact reference card is adapted from official documentation and is not a community-verified experience.

MDN Web Docs — files/en-us/web/javascript/reference/statements/export/index.md :: Re-exporting / Aggregating ↗Revision d14bee540b53 · CC-BY-SA-2.5 and attribution
#reference-seed#mdn#web#javascript#reference#statements#export#re-exporting#aggregating