-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
option for not dropping function expression names #552
Comments
Hello, I need to +1 this because this has bitten me today and I can no longer deploy any updates to the app. I have a genuine use for keeping (and referencing) function names. Your argument that they should not be relied upon (in one of the relevant threads) does not really solve my problem. Can you provide us with an option to either keep all function expression names, or at least get to explicitly specify the names of the functions we want to keep (they are static, after-all)? |
+1 this screws up regenerator |
@monsanto How does this screw up regenerator? |
The runtime has this: |
You can pass You can simply not pass Is there any issue here that is not solved by either of those options? |
Aren't there other places besides function expression names that this would affect? For example, unused parameters, unused var declarations, etc. This request is specifically for an option to control function expressions only.
Mangling is critical to reducing file size. Turning it completely off is a total non-starter. Again, this issue is requesting control over the mangling ONLY of function expression names, as those are typically included specifically for debugging purposes. |
Thanks for your clarification.
Would |
I won't bikeshed on naming of the options, and will leave that to your expertise, but One further clarification, from my OP in the thread... the desire on suppressing mangling would be to not mangle any function names, regardless of function expression vs function decl. The reason is for stack traces, where all function names are useful to understand context of an error. IOW, we'd not care nearly as much about variable names having been mangled (good for smaller file size!) but function names have much more importance in stack traces so an option to keep them as-is would be very nice. :) |
Furthermore, it might be that these two different requests logically belong together, combined as a single option, perhaps called I don't have a strong opinion either way on that. I can say that my likely use would be to always want either both or neither, so having a combined option that implied both wouldn't restrict my use cases. But that's just one anecdote to consider. |
…ssion names See mishoo#552. This is useful for stack traces.
I think that having separate options make slightly more sense. Among other things, it's easier for testing. Retaining function expression names is implemented in #602. It should do the trick. About the function name mangling: I think you're probably right in that it should be all function names. It doesn't really make sense to mix mangled and non-mangled function names. My idea is to have a flag for mangling, which would give: |
See mishoo#552. This is mostly useful for having the actual function names in traces.
See mishoo#552. This is mostly useful for having the actual function names in traces.
<3 thanks!! |
Passing `--keep-fnames` will enable it both for compressor/mangler, so that function names will not be dropped (when unused) nor mangled.
…ssion names See mishoo#552. This is useful for stack traces.
See mishoo#552. This is mostly useful for having the actual function names in traces.
Passing `--keep-fnames` will enable it both for compressor/mangler, so that function names will not be dropped (when unused) nor mangled.
I'll close this now, as the functionality now exists ( Thanks! |
Sorry, what does |
|
Whoops, sorry. Mistyped there - I meant |
OK, so I thought there were going to be two separate options, one for not dropping function names and one for not mangling them? Perhaps I misunderstood, or did those two options just get combined into |
For both the compressor and mangler there are separate options:
As a shorthard, |
More exactly, compressor options are different from mangler options. In this specific case, both accept a boolean option with the name As @rvanvelzen stated, there's also a “global” option which can be passed to the command-line tool, Hope this clarifies. |
awesomeness all around. thanks so much for the clarifications, you all rock! |
There are reasons other than lexical reference why people may rely on names of named function expressions.
See:
Please add an option that preserves all function expression names.
Note: It is unclear if such an option should continue to allow such (preserved) function expression names to be mangled or not. On one hand, it would be nice if they wouldn't be mangled, because that could make debug stack traces (even in production code) much more useful. OTOH, function declaration names would still be mangled, so parts of the debug stack traces (in production code) would still be much less useful.
Perhaps then mangling should still happen on the preserved function expression names, but then another option could say "don't mangle any function names"?
The text was updated successfully, but these errors were encountered: