refactor code: move compile out of index.js