> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript Re-Export

Re-exporting in JavaScript is the process of forwarding module bindings from one module through another without importing those bindings into the current module's local scope. It combines the `import` and `export` declarations into a single statement, allowing a module to act as a pass-through for variables, functions, or classes defined in a different file.

Because re-exported bindings are never evaluated in the local scope of the forwarding module, they cannot be accessed or manipulated by the forwarding module itself.

## Syntax Variations

JavaScript provides several syntactic forms for re-exporting, depending on whether you are handling named exports, default exports, or entire module namespaces.

### 1. Named Re-exports

You can selectively forward specific named exports from a target module. You can also alias these exports during the pass-through using the `as` keyword.

```javascript theme={"dark"}
// Forward specific named exports exactly as they are
export { foo, bar } from './moduleA.js';

// Forward specific named exports under new identifiers (aliasing)
export { foo as newFoo, bar as newBar } from './moduleA.js';
```

### 2. Namespace Re-exports

You can forward all named exports from a target module using the `*` wildcard.

```javascript theme={"dark"}
// Forward all named exports from moduleA
export * from './moduleA.js';

// Forward all named exports as a single namespace object (Introduced in ES2020)
export * as moduleANamespace from './moduleA.js';
```

*Note: The `export * from './moduleA.js'` syntax explicitly ignores the `default` export of `moduleA.js`. It only forwards named exports.*

### 3. Default Re-exports

Handling default exports requires explicit syntax, as the `default` keyword is treated as a specific named binding in the ES module system.

```javascript theme={"dark"}
// Forward the target's default export as this module's default export
export { default } from './moduleA.js';

// Forward the target's default export as a named export
export { default as moduleADefault } from './moduleA.js';

// Forward a target's named export as this module's default export
export { foo as default } from './moduleA.js';
```

## Technical Constraints and Behavior

* **Scope Isolation:** If you write `export { foo } from './moduleA.js';`, the identifier `foo` is not declared in the current file. Attempting to `console.log(foo)` in the forwarding file will result in a `ReferenceError`.
* **Name Collisions:** If you use `export * from './moduleA.js'` and `export * from './moduleB.js'`, and both modules export a binding with the same name, JavaScript will not throw an error immediately. However, a `SyntaxError` will be thrown when another module attempts to import the conflicted binding from the forwarding module.
* **Live Bindings:** Like standard exports, re-exports maintain live bindings to the original module. If the value of a re-exported variable changes in the originating module, that change is reflected wherever the re-export is consumed.

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor JavaScript Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
