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

This has been tested using "stage", but not yet with "dist".  Should
work, though.
Merge pull request #18 from jducoeur/auto-detect-opt

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