Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move modularization code into js compiler #23261

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Include CJS / AMD module exports under MINIMAL_RUNTIME
I don't see why `-sMINIMAL_RUNTIME` users would not want the same
exporting of the module.  The EXPORT_ES6 behaviour was already matching.
This change is necessary are part of #23261 which feeds the modularized
code through closure and our acorn optimizations.  Without this closer
things the entire module factory is seen as unused and is deleted.
sbc100 committed Jan 3, 2025
commit 03b9a0d123674d103b80eff891aff2c46fcb35a2
8 changes: 4 additions & 4 deletions test/code_size/hello_webgl2_wasm.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.html": 454,
"a.html.gz": 328,
"a.js": 4538,
"a.js.gz": 2320,
"a.js": 4706,
"a.js.gz": 2383,
"a.wasm": 10206,
"a.wasm.gz": 6663,
"total": 15198,
"total_gz": 9311
"total": 15366,
"total_gz": 9374
}
8 changes: 4 additions & 4 deletions test/code_size/hello_webgl2_wasm2js.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"a.html": 346,
"a.html.gz": 262,
"a.js": 22202,
"a.js.gz": 11604,
"total": 22548,
"total_gz": 11866
"a.js": 22370,
"a.js.gz": 11669,
"total": 22716,
"total_gz": 11931
}
8 changes: 4 additions & 4 deletions test/code_size/hello_webgl_wasm.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.html": 454,
"a.html.gz": 328,
"a.js": 4076,
"a.js.gz": 2163,
"a.js": 4244,
"a.js.gz": 2227,
"a.wasm": 10206,
"a.wasm.gz": 6663,
"total": 14736,
"total_gz": 9154
"total": 14904,
"total_gz": 9218
}
8 changes: 4 additions & 4 deletions test/code_size/hello_webgl_wasm2js.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"a.html": 346,
"a.html.gz": 262,
"a.js": 21728,
"a.js.gz": 11435,
"total": 22074,
"total_gz": 11697
"a.js": 21896,
"a.js.gz": 11500,
"total": 22242,
"total_gz": 11762
}
2 changes: 1 addition & 1 deletion tools/link.py
Original file line number Diff line number Diff line change
@@ -2494,7 +2494,7 @@ def modularize():
src += 'export {' + ', '.join(exports) + '};\n'
else:
src += 'export default %s;\n' % settings.EXPORT_NAME
elif not settings.MINIMAL_RUNTIME:
else:
src += '''\
if (typeof exports === 'object' && typeof module === 'object') {
module.exports = %(EXPORT_NAME)s;