Auto-detect production mode, and use the right .js file

This has been tested using "stage", but not yet with "dist".  Should
work, though.