Home / Function/ load() — react Function Reference

load() — react Function Reference

Architecture documentation for the load() function in server.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9818087d_1057_602c_c2bf_ccd21874e49a["load()"]
  2147ecb6_7b0c_5060_7d10_643cc38d3dff["server.js"]
  9818087d_1057_602c_c2bf_ccd21874e49a -->|defined in| 2147ecb6_7b0c_5060_7d10_643cc38d3dff
  style 9818087d_1057_602c_c2bf_ccd21874e49a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fixtures/view-transition/loader/server.js lines 12–33

export async function load(url, context, defaultLoad) {
  if (url.endsWith('.css')) {
    return {source: 'export default {}', format: 'module', shortCircuit: true};
  }
  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

Frequently Asked Questions

What does load() do?
load() is a function in the react codebase, defined in fixtures/view-transition/loader/server.js.
Where is load() defined?
load() is defined in fixtures/view-transition/loader/server.js at line 12.

Analyze Your Own Codebase

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

Try Supermodel Free