Home / Function/ handleRollupWarning() — react Function Reference

handleRollupWarning() — react Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

scripts/rollup/build.js lines 753–791

function handleRollupWarning(warning) {
  if (warning.code === 'UNUSED_EXTERNAL_IMPORT') {
    const match = warning.message.match(/external module "([^"]+)"/);
    if (!match || typeof match[1] !== 'string') {
      throw new Error(
        'Could not parse a Rollup warning. ' + 'Fix this method.'
      );
    }
    const importSideEffects = Modules.getImportSideEffects();
    const externalModule = match[1];
    if (typeof importSideEffects[externalModule] !== 'boolean') {
      throw new Error(
        'An external module "' +
          externalModule +
          '" is used in a DEV-only code path ' +
          'but we do not know if it is safe to omit an unused require() to it in production. ' +
          'Please add it to the `importSideEffects` list in `scripts/rollup/modules.js`.'
      );
    }
    // Don't warn. We will remove side effectless require() in a later pass.
    return;
  }

  if (warning.code === 'CIRCULAR_DEPENDENCY') {
    // Ignored
  } else if (typeof warning.code === 'string') {
    // This is a warning coming from Rollup itself.
    // These tend to be important (e.g. clashes in namespaced exports)
    // so we'll fail the build on any of them.
    console.error();
    console.error(warning.message || warning);
    console.error();
    process.exit(1);
  } else {
    // The warning is from one of the plugins.
    // Maybe it's not important, so just print it.
    console.warn(warning.message || warning);
  }
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free