@@ -5,7 +5,6 @@ import type { Module, Directory } from 'common/types';
55
66import evalModule from '../' ;
77import resolveModule from '../../utils/resolve-module' ;
8- import DependencyNotFoundError from '../../errors/dependency-not-found-error' ;
98import resolveDependency from './dependency-resolver' ;
109import getBabelConfig from './babel-parser' ;
1110
@@ -59,31 +58,28 @@ export default function evaluateJS(
5958 // eslint-disable-line no-unused-vars
6059 if ( / ^ ( \w | @ ) / . test ( path ) ) {
6160 // So it must be a dependency
62- const dependency = resolveDependency ( path , externals ) ;
63- if ( dependency ) return dependency ;
61+ return resolveDependency ( path , externals ) ;
62+ }
6463
65- throw new DependencyNotFoundError ( path ) ;
66- } else {
67- const module = resolveModule (
68- path ,
69- modules ,
70- directories ,
71- mainModule . directoryShortid ,
72- ) ;
73- if ( mainModule === module ) {
74- throw new Error ( `${ mainModule . title } is importing itself` ) ;
75- }
64+ const module = resolveModule (
65+ path ,
66+ modules ,
67+ directories ,
68+ mainModule . directoryShortid ,
69+ ) ;
70+ if ( mainModule === module ) {
71+ throw new Error ( `${ mainModule . title } is importing itself` ) ;
72+ }
7673
77- if ( ! module ) throw new Error ( `Cannot find module in path: ${ path } ` ) ;
74+ if ( ! module ) throw new Error ( `Cannot find module in path: ${ path } ` ) ;
7875
79- requires . push ( module . id ) ;
80- // Check if this module has been evaluated before, if so return that
81- const cache = moduleCache . get ( module . id ) ;
76+ requires . push ( module . id ) ;
77+ // Check if this module has been evaluated before, if so return that
78+ const cache = moduleCache . get ( module . id ) ;
8279
83- return cache
84- ? cache . exports
85- : evalModule ( module , modules , directories , externals , depth + 1 ) ;
86- }
80+ return cache
81+ ? cache . exports
82+ : evalModule ( module , modules , directories , externals , depth + 1 ) ;
8783 } ;
8884
8985 const babelConfig = getBabelConfig (
0 commit comments