-
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 new 'none' ENVIRONMENT #12184
Comments
For your use case is standalone wasm the best option? That emits no JS at all, just wasm, that you download yourself. If not, then I think we could make |
No, I need the JS because I use FS, EM_JS, Asyncify, etc. I thought adding |
Ah yes, the empty string means "everything" right now, so we do need something like |
With the new potential way of doing environment stuff, I'm wondering if a setting like MANUALLY_PROVIDE_WASM might be better instead - it would just cut out all of the loading code in expectation that wasmBinary would be provided on Module. |
@curiousdannii I think that makes sense, since the core of your idea is around loading the wasm. We already have a |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
This is still worth considering |
I've found that this is actually pretty necessary. So currently I'm using ENVIRONMENT=web because I don't want any of the Edit: And setting ENVIRONMENT=node still doesn't work in ES6 modules in Node because |
Would making Maybe we could have something like |
This still outputs I've previously been using ENVIRONMENT=web because it's the most platform agnostic option, however if you then turn on ASSERTIONS it has runtime errors if it can't find the browser. So the assertions are testing for things that it doesn't actually use. 😕 |
Yes, but presumably it should not, since the user is asking for an ES6 module.. in which case require should not be in the output. If we fixed that .. would that work for you? |
That would be a much bigger improvement, though we've been waiting a long time for that haha. A none option would still be nice for reducing file size a little though. |
Should |
Yes it should be able to do node and/or browser depending on what the environment is. They're orthogonal settings. The issue is that EXPORT_ES6 currently only changes the exporting code, not the importing code. The main issue is #11792. Also relevant: #12203 Probably the big issue is that for multi-environment builds, it would require using the |
I see.. so fixing Do you think that making a new Can we think of |
Something like #12203 would probably be a big improvement, and it seems that's the way @kripken wanted to go. If it's approached from the top down, then adding a
We have three main settings impacting output modes, and they're all orthogonal: |
I see, so it is possible to have an ES6 module that uses node-specific, or web-specific builtins? Its just happens that the |
All the Node standard modules are still there, you just have to |
I'll admit that I don't fully understand the details/implications of this conversation, but I think this is something I'd really like to see as well. My use case builds wasm which is strictly for computational purposes– takes numbers and returns numbers. My wasm bundle doesn't need any Node/Web/Etc APIs but I'm still struggling to find the right way to ask Emscripten to output a bundle which reflects this (i.e. a bundle which includes no mention of If there's an existing way to do that please let me know, but otherwise chiming in here for a +1 on a 'none' environment. Thanks! |
I would love to help with this. (I was commenting over on that linked issue #11792 , and it should have more context.) For me, it's more of a reduction of current es6-type, rather than an addition. Currently, I edit the generated code by hand to inject EDIT: @curiousdannii mentioned |
Use Two little issues:
|
Good call. On point 2: the whole problem I have is that I want to skip all the code that does the byte-loading (so, no need for |
Well I want that too, that's what this issue is for. 😉 But with the right settings you can get it to work currently, it just outputs a little bit of unnecessary code. Compared to the size of the rest of the build I don't care about that though. |
So in my project I'm manually downloading the WASM file, mainly so that I can do it in parallel with other large files, but also potentially so that I could add a download progress meter.
What would you think about adding a new ENVIRONMENT option of 'none' which would stop all shell type code from being emitted, would prevent the JS from trying to locate and download the WASM, would make the resulting code perfectly platform-agnostic, with no
require
calls, etc?Things that would be slightly less optimal under this situation:
_emscripten_get_now
might be less accurate in Nodeget_char
in NodeThe text was updated successfully, but these errors were encountered: