extract main module to a file.