Skip to content

Commit 4195cdb

Browse files
committed
simplify declaration of the modularize function
1 parent 9f60204 commit 4195cdb

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}
@@ -1172,15 +1171,11 @@ def generate_js(data_target, data_files, metadata):
11721171

11731172
if options.modularize and not options.from_emcc:
11741173
ret += '''
1175-
});'''
1176-
1177-
ret += '''
1174+
};'''
1175+
else:
1176+
ret += '''
11781177
})();\n'''
11791178

1180-
if options.modularize and not options.from_emcc:
1181-
ret += '''
1182-
export default %(EXPORT_NAME)s;''' % {"EXPORT_NAME": options.export_name}
1183-
11841179
return ret
11851180

11861181

0 commit comments

Comments
 (0)