Skip to content

Commit 5b3e4ca

Browse files
committed
simplify declaration of the modularize function
1 parent e5f2a9f commit 5b3e4ca

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}
@@ -1157,15 +1156,11 @@ def generate_js(data_target, data_files, metadata):
11571156

11581157
if options.modularize and not options.from_emcc:
11591158
ret += '''
1160-
});'''
1161-
1162-
ret += '''
1159+
};'''
1160+
else:
1161+
ret += '''
11631162
})();\n'''
11641163

1165-
if options.modularize and not options.from_emcc:
1166-
ret += '''
1167-
export default %(EXPORT_NAME)s;''' % {"EXPORT_NAME": options.export_name}
1168-
11691164
return ret
11701165

11711166

0 commit comments

Comments
 (0)