minor main.js re-org
added auto-bundling and NODE_ENV modes