Amend the packager file to work better with aliases.

I rearranged a loop so that it adds the .js suffix after it checks the
aliases, so that one can specify aliases just like require.js.