Skip to content

Commit 1b74c3e

Browse files
committed
simplify declaration of the modularize function
1 parent 6d11cc1 commit 1b74c3e

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

tools/file_packager.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,10 @@ def generate_js(data_target, data_files, metadata):
622622
else:
623623
if options.modularize:
624624
ret = '''
625-
var %(EXPORT_NAME)s = (() => {
626-
627-
return (async function(moduleArg = {}) {
625+
export default function loadDataFile(moduleArg = {}) {
628626
var Module = moduleArg;
629-
''' % {"EXPORT_NAME": options.export_name}
627+
'''
628+
630629
else:
631630
ret = '''
632631
var Module = typeof %(EXPORT_NAME)s != 'undefined' ? %(EXPORT_NAME)s : {};\n''' % {"EXPORT_NAME": options.export_name}
@@ -1167,15 +1166,11 @@ def generate_js(data_target, data_files, metadata):
11671166

11681167
if options.modularize and not options.from_emcc:
11691168
ret += '''
1170-
});'''
1171-
1172-
ret += '''
1169+
};'''
1170+
else:
1171+
ret += '''
11731172
})();\n'''
11741173

1175-
if options.modularize and not options.from_emcc:
1176-
ret += '''
1177-
export default %(EXPORT_NAME)s;''' % {"EXPORT_NAME": options.export_name}
1178-
11791174
return ret
11801175

11811176

0 commit comments

Comments
 (0)