Javascript wait for require to finish. on("line") and .