Home / Function/ babelLoad() — react Function Reference

babelLoad() — react Function Reference

Architecture documentation for the babelLoad() function in region.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  2b4cde5f_1601_e59d_4d5e_cdfe1bd68414["babelLoad()"]
  9880abca_4eaa_66fe_8026_b2b3f05215a1["region.js"]
  2b4cde5f_1601_e59d_4d5e_cdfe1bd68414 -->|defined in| 9880abca_4eaa_66fe_8026_b2b3f05215a1
  13cafc1f_a2eb_95a9_469e_378c93045abb["load()"]
  13cafc1f_a2eb_95a9_469e_378c93045abb -->|calls| 2b4cde5f_1601_e59d_4d5e_cdfe1bd68414
  style 2b4cde5f_1601_e59d_4d5e_cdfe1bd68414 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fixtures/flight/loader/region.js lines 22–40

async function babelLoad(url, context, defaultLoad) {
  const {format} = context;
  const result = await defaultLoad(url, context, defaultLoad);
  if (result.format === 'module') {
    const opt = Object.assign({filename: url}, babelOptions);
    const newResult = await babel.transformAsync(result.source, opt);
    if (!newResult) {
      if (typeof result.source === 'string') {
        return result;
      }
      return {
        source: Buffer.from(result.source).toString('utf8'),
        format: 'module',
      };
    }
    return {source: newResult.code, format: 'module'};
  }
  return defaultLoad(url, context, defaultLoad);
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does babelLoad() do?
babelLoad() is a function in the react codebase, defined in fixtures/flight/loader/region.js.
Where is babelLoad() defined?
babelLoad() is defined in fixtures/flight/loader/region.js at line 22.
What calls babelLoad()?
babelLoad() is called by 1 function(s): load.

Analyze Your Own Codebase

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

Try Supermodel Free