improving ES modules detection by using RegExp

Fixes issue #1