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

Add tests that use emscripten output in a bundler (webpack). NFC #18969

Merged
merged 2 commits into from
Mar 15, 2023

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Mar 15, 2023

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.

@sbc100 sbc100 force-pushed the webpack_tests branch 2 times, most recently from 6bd1550 to 67c897d Compare March 15, 2023 17:35
@sbc100 sbc100 requested a review from kripken March 15, 2023 17:35
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.
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.

Nice!

test/webpack/dist/index.html Outdated Show resolved Hide resolved
Co-authored-by: Alon Zakai <azakai@google.com>
@sbc100 sbc100 requested a review from RReverser March 15, 2023 20:31
@sbc100 sbc100 merged commit 324e5da into main Mar 15, 2023
@sbc100 sbc100 deleted the webpack_tests branch March 15, 2023 20:31
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'])
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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

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

impact-maker pushed a commit to impact-maker/emscripten that referenced this pull request Mar 17, 2023
…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.
impact-maker pushed a commit to impact-maker/emscripten that referenced this pull request Mar 17, 2023
…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.
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.

4 participants