generate module for files without source maps

When javascript files are loaded in the browser directly without concatenation and source maps, the displayed module name is the full URL of the script. This commit fixes it and generates a proper module name for such files as well.

Fixes #1108