Home / Function/ getAdditionalModulePaths() — react Function Reference

getAdditionalModulePaths() — react Function Reference

Architecture documentation for the getAdditionalModulePaths() function in modules.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  0b7183d8_178c_8dd8_5021_bea43d803fc1["getAdditionalModulePaths()"]
  b6a11056_3d6d_cb05_84d6_323c82d395a3["modules.js"]
  0b7183d8_178c_8dd8_5021_bea43d803fc1 -->|defined in| b6a11056_3d6d_cb05_84d6_323c82d395a3
  831d1d12_35bd_bd87_0f11_8537b00e2357["getModules()"]
  831d1d12_35bd_bd87_0f11_8537b00e2357 -->|calls| 0b7183d8_178c_8dd8_5021_bea43d803fc1
  style 0b7183d8_178c_8dd8_5021_bea43d803fc1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fixtures/flight/config/modules.js lines 14–50

function getAdditionalModulePaths(options = {}) {
  const baseUrl = options.baseUrl;

  if (!baseUrl) {
    return '';
  }

  const baseUrlResolved = path.resolve(paths.appPath, baseUrl);

  // We don't need to do anything if `baseUrl` is set to `node_modules`. This is
  // the default behavior.
  if (path.relative(paths.appNodeModules, baseUrlResolved) === '') {
    return null;
  }

  // Allow the user set the `baseUrl` to `appSrc`.
  if (path.relative(paths.appSrc, baseUrlResolved) === '') {
    return [paths.appSrc];
  }

  // If the path is equal to the root directory we ignore it here.
  // We don't want to allow importing from the root directly as source files are
  // not transpiled outside of `src`. We do allow importing them with the
  // absolute path (e.g. `src/Components/Button.js`) but we set that up with
  // an alias.
  if (path.relative(paths.appPath, baseUrlResolved) === '') {
    return null;
  }

  // Otherwise, throw an error.
  throw new Error(
    chalk.red.bold(
      "Your project's `baseUrl` can only be set to `src` or `node_modules`." +
        ' Create React App does not support other values at this time.'
    )
  );
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getAdditionalModulePaths() do?
getAdditionalModulePaths() is a function in the react codebase, defined in fixtures/flight/config/modules.js.
Where is getAdditionalModulePaths() defined?
getAdditionalModulePaths() is defined in fixtures/flight/config/modules.js at line 14.
What calls getAdditionalModulePaths()?
getAdditionalModulePaths() is called by 1 function(s): getModules.

Analyze Your Own Codebase

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

Try Supermodel Free