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

Minification & debugging #2263

Closed
danielkcz opened this issue Jan 25, 2020 · 5 comments
Closed

Minification & debugging #2263

danielkcz opened this issue Jan 25, 2020 · 5 comments

Comments

@danielkcz
Copy link
Contributor

Originally posted by @elektronik2k5 in #2262 (comment)


digging a bit further into the code, I see it isn't that simple. I understand that and am not challenging it any further right now - and definitely not as part of this PR.

However, I still want to address some of your assertions and perhaps we can improve it in the future:

Function names are usually minified.

You're right: function names are usually mangled. Practically always in browsers and often in node packages which go through a build/compilation step.

However, that is not always the case:

  • I always configured the minifiers in my projects to not mangle function names cause I value readable stack traces in production much more than the negligible size decrease which mangling produces. You can have minification and keep readable names thanks to gzip/brotli. And it doesn't negate all other minification tricks. :)
  • Thanks to all modern browsers supporting ESM, dynamic import() hitting stage 4, HTTP >= 2 and Brotli we have things like https://www.snowpack.dev/, where we're able to go back to working like once: via <script> tags and without bundling. It is a valid approach and a breath of fresh air in light of our currently tooling-heavy workflows.
  • In node, there's absolutely no need to minify anything, and we know mobx is used in node too.
  • Due to the fact that every application's target environment is different and package sources are written in different languages using different standards, there's talk of reversing the current standard of shipping ES5 packages and instead:
    • Shipping different target environment bundles: ES5, ES2015 without ESM, ESM + latest. Some packages already do this and bundler support is in place.
    • Ignoring bundled package artifacts altogether and having the bundler take care of compilation, polyfilling, minification, etc of raw source code. React Native does this, for example.

It would be inconsistent.

Only if we let it be inconsistent.

this is intended for debugging purposes mostly

In my view, debugging isn't a nice to have, but a first class feature of any tool/package I consider using.

@mweststrate
Copy link
Member

For context, what is the question / problem / suggested change here?

@elektronik2k5
Copy link
Contributor

I'm proposing to not skip function.name assignments for actions in production mode. Especially considering the fact that it won't harm bundle size or code complexity (though that's an assumption, cause I'm not really familiar with the codebase).

@danielkcz
Copy link
Contributor Author

@elektronik2k5 Are you willing to work on PR? At least some draft because it seems nobody understands what you want to achieve :) Or you might want to try to incorporate that change into upcoming V6 #2327. Closing this issue for now.

@mweststrate
Copy link
Member

@elektronik2k5 would you mind revisiting this when V6 branch is in more stable? We'll switch to a more standardized setup through TSDX, but we can fine tune things if needed.

@lock
Copy link

lock bot commented Jun 24, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants