Change file structure, add more safe export main.js