UNPKG

react-cosmos

Version:

Sandbox for developing and testing UI components in isolation

13 lines (12 loc) 527 B
import path from 'path'; import { resolveFromSilent } from './resolveSilent.js'; export function resolveLoose(fromDirectory, moduleId) { // Use to deal with file paths and module names interchangeably. return path.isAbsolute(moduleId) ? moduleId : resolveFromSilent(fromDirectory, moduleId) || // Final attempt: Resolve relative paths that don't either // 1. Don't start with ./ // 2. Don't point to an existing file path.join(fromDirectory, moduleId); }