File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
source/loaders/node_loader/bootstrap/lib Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -42,19 +42,36 @@ function node_loader_trampoline_load_from_file_require(p) {
4242 /* First try to load the absolute path */
4343 try {
4444 return require ( p ) ;
45- } catch ( e ) { }
45+ } catch ( e ) {
46+ if ( e . code !== 'MODULE_NOT_FOUND' ) {
47+ throw e ;
48+ }
49+ }
4650
4751 /* Then try to load without the path */
4852 const basename = path . basename ( p ) ;
4953
5054 try {
5155 return require ( basename ) ;
52- } catch ( e ) { }
56+ } catch ( e ) {
57+ if ( e . code !== 'MODULE_NOT_FOUND' ) {
58+ throw e ;
59+ }
60+ }
5361
54- /* Finally try to load without the path and extension */
62+ /* Try to load without the path and extension */
5563 const { name } = path . parse ( basename ) ;
5664
57- return require ( name ) ;
65+ try {
66+ return require ( name ) ;
67+ } catch ( e ) {
68+ if ( e . code !== 'MODULE_NOT_FOUND' ) {
69+ throw e ;
70+ }
71+ }
72+
73+ /* Try to load base path without extension and with node modules */
74+ return require ( path . join ( path . dirname ( p ) , 'node_modules' , name ) ) ;
5875}
5976
6077function node_loader_trampoline_load_from_file ( paths ) {
You can’t perform that action at this time.
0 commit comments