src/context.js
function nodeModulesResolverFn(normalizedId) {
		if (!nodeModulesAt) {
			throw new Error('Before you can load external dependencies, you must specify where node_modules can be found by ' +
				'setting the \'nodeModulesAt\' option when creating the context');
		}

		var extId = normalizedId.id;

		var modulePath = path.join(nodeModulesAt, extId);
		if (!externalDepExists[modulePath]) {
			// yes I know the docs don't like this method.
			// But it's a little better user experience than trying to require a file that isn't there.
			if (fs.existsSync(modulePath)) {
				externalDepExists[modulePath] = true; // cache it so we avoid the lookup next time

			} else {
				var msg = 'Could not find external dependency [' + extId + '] at path [' + modulePath + ']';
				throw new Error(buildMissingDepMsg(msg, extId, allExternalIds()));
			}

		}

		return require(modulePath);
	}
function nodeModulesResolverFn(normalizedId) {
		if (!nodeModulesAt) {
			throw new Error('Before you can load external dependencies, you must specify where node_modules can be found by ' +
				'setting the \'nodeModulesAt\' option when creating the context');
		}

		var extId = normalizedId.id;

		var modulePath = path.join(nodeModulesAt, extId);
		if (!externalDepExists[modulePath]) {
			// yes I know the docs don't like this method.
			// But it's a little better user experience than trying to require a file that isn't there.
			if (fs.existsSync(modulePath)) {
				externalDepExists[modulePath] = true; // cache it so we avoid the lookup next time

			} else {
				var msg = 'Could not find external dependency [' + extId + '] at path [' + modulePath + ']';
				throw new Error(buildMissingDepMsg(msg, extId, allExternalIds()));
			}

		}

		return require(modulePath);
	}
function nodeModulesResolverFn ( normalizedId ) { if ( ! nodeModulesAt ) { throw new Error ( 'Before you can load external dependencies, you must specify where node_modules can be found by ' + 'setting the \'nodeModulesAt\' option when creating the context' ) ; } var extId = normalizedId . id ; var modulePath = path . join ( nodeModulesAt , extId ) ; if ( ! externalDepExists [ modulePath ] ) { // yes I know the docs don't like this method. // But it's a little better user experience than trying to require a file that isn't there. if ( fs . existsSync ( modulePath ) ) { externalDepExists [ modulePath ] = true ; // cache it so we avoid the lookup next time } else { var msg = 'Could not find external dependency [' + extId + '] at path [' + modulePath + ']' ; throw new Error ( buildMissingDepMsg ( msg , extId , allExternalIds ( ) ) ) ; } } return require ( modulePath ) ; }
Requires modules from the node_modules directory
Requires modules from the node_modules directory