Skip to content

Commit c4e66fa

Browse files
committed
simplify declaration of the modularize function
1 parent 93d2bdc commit c4e66fa

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
@@ -627,11 +627,10 @@ def generate_js(data_target, data_files, metadata):
627627
else:
628628
if options.modularize:
629629
ret = '''
630-
var %(EXPORT_NAME)s = (() => {
631-
632-
return (async function(moduleArg = {}) {
630+
export default function loadDataFile(moduleArg = {}) {
633631
var Module = moduleArg;
634-
''' % {"EXPORT_NAME": options.export_name}
632+
'''
633+
635634
else:
636635
ret = '''
637636
var Module = typeof %(EXPORT_NAME)s != 'undefined' ? %(EXPORT_NAME)s : {};\n''' % {"EXPORT_NAME": options.export_name}
@@ -1163,15 +1162,11 @@ def generate_js(data_target, data_files, metadata):
11631162

11641163
if options.modularize and not options.from_emcc:
11651164
ret += '''
1166-
});'''
1167-
1168-
ret += '''
1165+
};'''
1166+
else:
1167+
ret += '''
11691168
})();\n'''
11701169

1171-
if options.modularize and not options.from_emcc:
1172-
ret += '''
1173-
export default %(EXPORT_NAME)s;''' % {"EXPORT_NAME": options.export_name}
1174-
11751170
return ret
11761171

11771172

0 commit comments

Comments
 (0)