Move export_env_dir to compile.