@@ -996,7 +996,11 @@ function (lang, logger, file, parse, optimize, pragma,
996
996
errMessage = '' ,
997
997
failedPluginMap = { } ,
998
998
failedPluginIds = [ ] ,
999
- errIds = [ ] ;
999
+ errIds = [ ] ,
1000
+ errUrlMap = { } ,
1001
+ errUrlConflicts = { } ,
1002
+ hasErrUrl = false ,
1003
+ errUrl , prop ;
1000
1004
1001
1005
//Reset some state set up in requirePatch.js, and clean up require's
1002
1006
//current context.
@@ -1042,6 +1046,21 @@ function (lang, logger, file, parse, optimize, pragma,
1042
1046
if ( registry . hasOwnProperty ( id ) && id . indexOf ( '_@r' ) !== 0 ) {
1043
1047
if ( id . indexOf ( '_unnormalized' ) === - 1 ) {
1044
1048
errIds . push ( id ) ;
1049
+ errUrl = registry [ id ] . map . url ;
1050
+
1051
+ if ( errUrlMap [ errUrl ] ) {
1052
+ hasErrUrl = true ;
1053
+ //This error module has the same URL as another
1054
+ //error module, could be misconfiguration.
1055
+ if ( ! errUrlConflicts [ errUrl ] ) {
1056
+ errUrlConflicts [ errUrl ] = [ ] ;
1057
+ //Store the original module that had the same URL.
1058
+ errUrlConflicts [ errUrl ] . push ( errUrlMap [ errUrl ] ) ;
1059
+ }
1060
+ errUrlConflicts [ errUrl ] . push ( id ) ;
1061
+ } else {
1062
+ errUrlMap [ errUrl ] = id ;
1063
+ }
1045
1064
}
1046
1065
1047
1066
//Look for plugins that did not call load()
@@ -1063,6 +1082,18 @@ function (lang, logger, file, parse, optimize, pragma,
1063
1082
failedPluginIds . join ( ', ' ) + '\n' ;
1064
1083
}
1065
1084
errMessage += 'Module loading did not complete for: ' + errIds . join ( ', ' ) ;
1085
+
1086
+ if ( hasErrUrl ) {
1087
+ errMessage += '\nThe following modules share the same URL. This ' +
1088
+ 'could be a misconfiguration if that URL only has ' +
1089
+ 'one anonymous module in it:' ;
1090
+ for ( prop in errUrlConflicts ) {
1091
+ if ( errUrlConflicts . hasOwnProperty ( prop ) ) {
1092
+ errMessage += '\n' + prop + ': ' +
1093
+ errUrlConflicts [ prop ] . join ( ', ' ) ;
1094
+ }
1095
+ }
1096
+ }
1066
1097
throw new Error ( errMessage ) ;
1067
1098
}
1068
1099
0 commit comments