-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
What to do about the --browser
flag?
#1332
Comments
Can we deprecate the flag and rename it to more accurately reflect its function? |
Yeah, replacing it with something like If it were a separate flag, then it would be useful with any of the modes, e.g. assuming modern Node versions, assuming modern browser versions, etc. |
@fitzgen yeah I think that's definitely an option, and may end up what we get at. @Pauan oh currently it's not so much about |
@alexcrichton Node v11.10.0 have |
Oh nice! I think that literally the only use case that So actually I think I agree with @Pauan in light of that. @Pauan to make sure I understand right though, I think we could:
I think we could even go with that |
@alexcrichton That sounds reasonable to me. I'm not sure about the value of |
We should change the file extension of |
@daxpedda The situation with So, outputting And it's not really needed to output This will give you better compatibility with existing tools which expect Regardless of whether you use
|
With RFC 6 now merged and implemented, along with a tweak or two, we now have the following output modes:
--nodejs
- generate CommonJS imports as well as assuming a synchronous instantiation is ok. Also assumes node.js for various support APIs.--web
- generates an ES module which exports a function to manually instantiate the wasm module. Intended for raw inclusion on web pages today.--no-modules
- like--web
, except incompatible with js snippets and provides a global instead of an ES module.In addition to all these flags we have this weird
--browser
flag sitting on the site. The only real purpose of this flag any more is to indicate that when no flags are specified (generating "bundler compatible output") the JS should assume that node.js isn't being used and browser APIs are always available. This is a slight optimization over not passing the flag as it allows us to elide the check for things like "where isTextDecoder
?" and such.The
--browser
flag has a pretty unfortunate name to say the least, being pretty confusing with the other flags. Should we keep the use case of slimming the JS by a few bytes? Should this just be deprecated and removed?The text was updated successfully, but these errors were encountered: