Home / Function/ handleRollupError() — react Function Reference

handleRollupError() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3ce0e110_9f1d_b1e2_86bd_0c1e010d4d72["handleRollupError()"]
  c80a1a72_0983_3915_42ad_1026a11c0a09["build.js"]
  3ce0e110_9f1d_b1e2_86bd_0c1e010d4d72 -->|defined in| c80a1a72_0983_3915_42ad_1026a11c0a09
  bb9629f0_8ad3_5155_4bf4_2cb0aa60d724["createBundle()"]
  bb9629f0_8ad3_5155_4bf4_2cb0aa60d724 -->|calls| 3ce0e110_9f1d_b1e2_86bd_0c1e010d4d72
  style 3ce0e110_9f1d_b1e2_86bd_0c1e010d4d72 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/rollup/build.js lines 793–821

function handleRollupError(error) {
  loggedErrors.add(error);
  if (!error.code) {
    console.error(error);
    return;
  }
  console.error(
    `\x1b[31m-- ${error.code}${error.plugin ? ` (${error.plugin})` : ''} --`
  );
  console.error(error.stack);
  if (error.loc && error.loc.file) {
    const {file, line, column} = error.loc;
    // This looks like an error from Rollup, e.g. missing export.
    // We'll use the accurate line numbers provided by Rollup but
    // use Babel code frame because it looks nicer.
    const rawLines = fs.readFileSync(file, 'utf-8');
    // column + 1 is required due to rollup counting column start position from 0
    // whereas babel-code-frame counts from 1
    const frame = codeFrame(rawLines, line, column + 1, {
      highlightCode: true,
    });
    console.error(frame);
  } else if (error.codeFrame) {
    // This looks like an error from a plugin (e.g. Babel).
    // In this case we'll resort to displaying the provided code frame
    // because we can't be sure the reported location is accurate.
    console.error(error.codeFrame);
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does handleRollupError() do?
handleRollupError() is a function in the react codebase, defined in scripts/rollup/build.js.
Where is handleRollupError() defined?
handleRollupError() is defined in scripts/rollup/build.js at line 793.
What calls handleRollupError()?
handleRollupError() is called by 1 function(s): createBundle.

Analyze Your Own Codebase

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

Try Supermodel Free