-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add tests that use emscripten output in a bundler (webpack). NFC #18969
Conversation
6bd1550
to
67c897d
Compare
If we want to iterate and improve on or support for MODULARIZE I think its good it we start testing it in the environments where it will likely be used. This change and an initial test for the use of MODULARIZE with the webpack bundler and verifies that the resulting bundle works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Co-authored-by: Alon Zakai <azakai@google.com>
def test_webpack(self): | ||
shutil.copytree(test_file('webpack'), 'webpack') | ||
with utils.chdir('webpack'): | ||
self.compile_btest([test_file('hello_world.c'), '-sEXIT_RUNTIME', '-sMODULARIZE', '-sENVIRONMENT=web', '-o', 'src/hello.js']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to have a separate one for EXPORT_ES6
too as it intentionally emits some bundler-specific tricks since #14135.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm planning on adding more tests of different bundlers and using ES6 modules.
BTW, I was thinking of make -sMODULARIZE
take a string. So you would do -sMODULARIZE=ES6
or -sMODULARIZE=CJS
or -sMODULARIZE=AMD
.. then we could think about perhaps one day changing the default -sMODULARIZE
from CJS to ES6 at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shrug I'm not sure it's worth investing in other old formats like AMD to the point where we'd have a separate config for them, and EXPORT_ES6 already works on its own w/o explicit MODULARIZE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh cool, I forgot about that.
I'll add some more bundler tests with ES6 then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try my hand at these as I have already put a few together here: https://github.com/dhdaines/webpack-wasm-test
…cripten-core#18969) If we want to iterate and improve on or support for MODULARIZE I think its good it we start testing it in the environments where it will likely be used. This change and an initial test for the use of MODULARIZE with the webpack bundler and verifies that the resulting bundle works.
…cripten-core#18969) If we want to iterate and improve on or support for MODULARIZE I think its good it we start testing it in the environments where it will likely be used. This change and an initial test for the use of MODULARIZE with the webpack bundler and verifies that the resulting bundle works.
If we want to iterate and improve on or support for MODULARIZE I think
its good it we start testing it in the environments where it will
likely be used.
This change and an initial test for the use of MODULARIZE with the
webpack bundler and verifies that the resulting bundle works.