Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Dec 30, 2024

This change effectively reverts #23169 because it turns out there are quite a few other places in the codebase that depend on being able to call require.

@sbc100 sbc100 force-pushed the revert_createRequire branch from 29fac54 to 66c5f53 Compare December 31, 2024 00:28
@sbc100 sbc100 requested review from kleisauke and kripken December 31, 2024 00:28
@kripken
Copy link
Member

kripken commented Dec 31, 2024

What is the advantage? On code size it doesn't seem to help here IIUC

@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 31, 2024

See #23169 (comment).

We have a lot of uses of require in the codebase. So this is basically fixing a regression caused by #23169

@kripken
Copy link
Member

kripken commented Dec 31, 2024

I see, but if it's fixing a regression, why doesn't code size improve here? Or is the regression not covered by existing tests?

This change effectively reverts emscripten-core#23169 because it turns out there are
quite a few other places in the codebase that depend on being able
to call `require`.
@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 31, 2024

I see, but if it's fixing a regression, why doesn't code size improve here? Or is the regression not covered by existing tests?

The regression is not covered by the existing tests. We would need to add tests that target each of our require usages, and combine them with -sMODULARIZE.

The code size regressions are pretty minor and bascially the inverse of the improvments from #23169

@sbc100 sbc100 force-pushed the revert_createRequire branch from 66c5f53 to 27c3d08 Compare December 31, 2024 01:29
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks, sounds good.

@sbc100 sbc100 merged commit e352c4e into emscripten-core:main Dec 31, 2024
28 checks passed
@sbc100 sbc100 deleted the revert_createRequire branch December 31, 2024 20:16
sbc100 added a commit to sbc100/emscripten that referenced this pull request Jan 28, 2025
For most uses of `require()` in emscripten this does not matter since
we load mostly system libraries.  However for the `ws` module it is
needed.  This bug was being masked by the fact that we were setting
`NODE_PATH` in our socket test running.  This is no longer needed now
that we run (non-parallel) tests in the emscripten tree (in out/test).

This is followup to emscripten-core#23265 which itself was an attempt to revert 23169.

Fixes: emscripten-core#23503
sbc100 added a commit to sbc100/emscripten that referenced this pull request Jan 28, 2025
For most uses of `require()` in emscripten this does not matter since
we load mostly system libraries.  However for the `ws` module it is
needed.  This bug was being masked by the fact that we were setting
`NODE_PATH` in our socket test running.  This is no longer needed now
that we run (non-parallel) tests in the emscripten tree (in out/test).

This is followup to emscripten-core#23265 which itself was an attempt to revert 23169.

Fixes: emscripten-core#23503
sbc100 added a commit to sbc100/emscripten that referenced this pull request Jan 28, 2025
For most uses of `require()` in emscripten this does not matter since
we load mostly system libraries.  However for the `ws` module it is
needed.  This bug was being masked by the fact that we were setting
`NODE_PATH` in our socket test running.  This is no longer needed now
that we run (non-parallel) tests in the emscripten tree (in out/test).

This is followup to emscripten-core#23265 which itself was an attempt to revert 23169.

Fixes: emscripten-core#23503
sbc100 added a commit to sbc100/emscripten that referenced this pull request Jan 28, 2025
For most uses of `require()` in emscripten this does not matter since
we load mostly system libraries.  However for the `ws` module it is
needed.  This bug was being masked by the fact that we were setting
`NODE_PATH` in our socket test running.  This is no longer needed now
that we run (non-parallel) tests in the emscripten tree (in out/test).

This is followup to emscripten-core#23265 which itself was an attempt to revert 23169.

Fixes: emscripten-core#23503
sbc100 added a commit to sbc100/emscripten that referenced this pull request Jan 28, 2025
For most uses of `require()` in emscripten this does not matter since
we load mostly system libraries.  However for the `ws` module it is
needed.  This bug was being masked by the fact that we were setting
`NODE_PATH` in our socket test running.  This is no longer needed now
that we run (non-parallel) tests in the emscripten tree (in out/test).

This is followup to emscripten-core#23265 which itself was an attempt to revert 23169.

Fixes: emscripten-core#23503
sbc100 added a commit that referenced this pull request Jan 28, 2025
For most uses of `require()` in emscripten this does not matter since we
load mostly system libraries. However for the `ws` module it is needed.
This bug was being masked by the fact that we were setting `NODE_PATH`
in our socket test running. This is no longer needed now that we run
(non-parallel) tests in the emscripten tree (in out/test).

This is followup to #23265 which itself was an attempt to revert #23169.

Fixes: #23503
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants