Fix the jsbuild integration with the CommonJS package system.
Change dependency-resolving code so that modules work sensibly when concatenated with jsbuild.