File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,12 @@ define([
37
37
38
38
babel . registerPlugin ( 'module-resolver' , moduleResolver ) ;
39
39
40
- function resolvePath ( sourcePath ) {
40
+ function resolvePath ( sourcePath , currentFile ) {
41
41
if ( sourcePath . indexOf ( '!' ) < 0 ) {
42
- return 'es6!' + sourcePath ;
42
+ // If sourcePath is relative (ex: "./foo"), it's relative to currentFile.
43
+ var absSourcePath = / ^ \. ? \. \/ / . test ( sourcePath ) ? currentFile . replace ( / [ ^ / ] * $ / , "" ) + sourcePath :
44
+ sourcePath ;
45
+ return 'es6!' + absSourcePath ;
43
46
}
44
47
}
45
48
var excludedOptions = [ 'extraPlugins' , 'resolveModuleSource' ] ;
@@ -66,7 +69,7 @@ define([
66
69
return {
67
70
//>>excludeStart('excludeBabel', pragmas.excludeBabel)
68
71
load : function ( name , req , onload , config ) {
69
- var sourceFileName = name + fileExtension ;
72
+ var sourceFileName = / \. / . test ( name ) ? name : name + fileExtension ;
70
73
var url = req . toUrl ( sourceFileName ) ;
71
74
72
75
if ( url . indexOf ( 'empty:' ) === 0 ) {
@@ -92,7 +95,7 @@ return {
92
95
_buildMap [ name ] = code ;
93
96
}
94
97
95
- onload . fromText ( code ) ;
98
+ onload . fromText ( code ) ;
96
99
} ) ;
97
100
} ,
98
101
You can’t perform that action at this time.
0 commit comments