remove partially-loaded module from require.modules when compilation fails
special case string.endsWith() when suffix is longer than input, preventing false positive