packages/crafty/src/configuration.js
function resolveModule(module) {
  debug("resolveModule", module);

  const presetName = module;

  if (path.isAbsolute(presetName)) {
    return [getPresetName(module), module];
  }

  try {
    // Try the naive way
    return [presetName, require.resolve(module)];
  } catch (e) {
    // Try a more advanced way
    return [presetName, resolve.sync(process.cwd() + "/node_modules", module)];
  }
}
function resolveModule(module) {
  debug("resolveModule", module);

  const presetName = module;

  if (path.isAbsolute(presetName)) {
    return [getPresetName(module), module];
  }

  try {
    // Try the naive way
    return [presetName, require.resolve(module)];
  } catch (e) {
    // Try a more advanced way
    return [presetName, resolve.sync(process.cwd() + "/node_modules", module)];
  }
}
function resolveModule ( module ) { debug ( "resolveModule" , module ) ; const presetName = module ; if ( path . isAbsolute ( presetName ) ) { return [ getPresetName ( module ) , module ] ; } try { // Try the naive way return [ presetName , require . resolve ( module ) ] ; } catch ( e ) { // Try a more advanced way return [ presetName , resolve . sync ( process . cwd ( ) + "/node_modules" , module ) ] ; } }
A module can be a a full path or just a module name
From that we'll try to find the name of the preset and the file that contains it.
@param {String} module
A module can be a a full path or just a module name From that we ll try to find the name of the preset and the file that contains it .