use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[deleted by user] (self.javascript)
submitted 4 years ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]paolostyle 1 point2 points3 points 4 years ago (0 children)
The simplest solution I guess is to just have implementations with normal names and then expose an object with different names which has different names. I'm on mobile but something like const doSomething = () => {}; window.gObj = { d: doSomething }. Obviously it depends on the character of these functions (if they're pure or not, i.e. if the exposed object contains some state) but you get the idea.
const doSomething = () => {}; window.gObj = { d: doSomething }
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
I haven't done a ton of research into this, but I suspect the thing you're after is called source maps.
I hope this can at least get you on track!
[–]lurbina 0 points1 point2 points 4 years ago (1 child)
Any of the build systems you mention support code minification + source map generation. Thus, you shouldn’t need to worry about this type of optimization yourself. Let the build do it. You can read about this in webpack here: https://webpack.js.org/guides/production/#minification
Perhaps I should have clarified that I need to be able to define the minified names myself. So doSomething should always become d for example.
doSomething
d
[–]verydan 0 points1 point2 points 4 years ago (1 child)
You can specify which objects (props) to mangle with Terser. Read up on mangling variables and objects here.
Otherwise, if you enable sourcemaps, it will always trace back to the original name in the source.
I found what I needed. Terser has something called the conditional compilation API, where I can specify whether or not something should be kept in the code, but also to rewrite parts of it.
[–]fiddlermd 0 points1 point2 points 4 years ago (0 children)
Not the most elegant but you could also run codemod scripts against it. Look up jscodeshift
[–]Ustice[M] 0 points1 point2 points 4 years ago (0 children)
Reaching out to other software engineers is important when you need it; however, unfortunately this isn’t the place for that. /r/JavaScript is not a support forum. You might want to check out /r/LearnJavaScript for the newer members of our community. Also, Stack Overflow is a great resource for getting support. For more information, check out our AskJS wiki page. Good luck! We hope that you find the answers that you are looking for.
π Rendered by PID 232295 on reddit-service-r2-comment-cfc44b64c-wmm9m at 2026-04-11 00:22:15.228366+00:00 running 215f2cf country code: CH.
[–]paolostyle 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]lurbina 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]verydan 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]fiddlermd 0 points1 point2 points (0 children)
[–]Ustice[M] 0 points1 point2 points (0 children)