Home / Function/ getRollupInteropValue() — react Function Reference

getRollupInteropValue() — react Function Reference

Architecture documentation for the getRollupInteropValue() function in build.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5098549b_30a4_904f_533d_7637ad1e038f["getRollupInteropValue()"]
  c80a1a72_0983_3915_42ad_1026a11c0a09["build.js"]
  5098549b_30a4_904f_533d_7637ad1e038f -->|defined in| c80a1a72_0983_3915_42ad_1026a11c0a09
  style 5098549b_30a4_904f_533d_7637ad1e038f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/rollup/build.js lines 174–201

let getRollupInteropValue = id => {
  // We're setting Rollup to assume that imports are ES modules unless otherwise specified.
  // However, we also compile ES import syntax to `require()` using Babel.
  // This causes Rollup to turn uses of `import SomeDefaultImport from 'some-module' into
  // references to `SomeDefaultImport.default` due to CJS/ESM interop.
  // Some CJS modules don't have a `.default` export, and the rewritten import is incorrect.
  // Specifying `interop: 'default'` instead will have Rollup use the imported variable as-is,
  // without adding a `.default` to the reference.
  const modulesWithCommonJsExports = [
    'art/core/transform',
    'art/modes/current',
    'art/modes/fast-noSideEffects',
    'art/modes/svg',
    'JSResourceReferenceImpl',
    'error-stack-parser',
    'neo-async',
    'webpack/lib/dependencies/ModuleDependency',
    'webpack/lib/dependencies/NullDependency',
    'webpack/lib/Template',
  ];

  if (modulesWithCommonJsExports.includes(id)) {
    return 'default';
  }

  // For all other modules, handle imports without any import helper utils
  return 'esModule';
};

Domain

Subdomains

Frequently Asked Questions

What does getRollupInteropValue() do?
getRollupInteropValue() is a function in the react codebase, defined in scripts/rollup/build.js.
Where is getRollupInteropValue() defined?
getRollupInteropValue() is defined in scripts/rollup/build.js at line 174.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free