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

Why minify packages for node? #1114

Closed
apla opened this issue Aug 24, 2020 · 8 comments
Closed

Why minify packages for node? #1114

apla opened this issue Aug 24, 2020 · 8 comments
Labels

Comments

@apla
Copy link

apla commented Aug 24, 2020

Description
I'm trying to debug custom requester and I see such useless backtraces:

    at handler (requester-project/js/utils/gitlabRequester.js:139:22)
    at Object.requester.<computed> [as get] (requester-project/js/utils/gitlabRequester.js:96:10)
    at Object.<anonymous> (requester-project/node_modules/@gitbeaker/core/dist/index.js:1)
    at requester-project/node_modules/@gitbeaker/core/dist/index.js:1
    at Object.next (requester-project/node_modules/@gitbeaker/core/dist/index.js:1)
    at requester-project/node_modules/@gitbeaker/core/dist/index.js:1
    at new Promise (<anonymous>)
    at u (requester-project/node_modules/@gitbeaker/core/dist/index.js:1)
    at Object.e [as get] (requester-project/node_modules/@gitbeaker/core/dist/index.js:1)
    at t.current (requester-project/node_modules/@gitbeaker/core/dist/index.js:1)

I can install your project, million of its dependencies and try to dive deeper into the error, but actually I should see the real backtrace and find out where is error comes from without any additional steps.

Proposal

Modules should not be minified and should represent original sources.

@jdalrymple
Copy link
Owner

The code is minified to reduce its footprint when being used in other packages. To aid in debugging, you could always just use the source and npm link it locally.

@Dianoga
Copy link

Dianoga commented Sep 2, 2020

I don't think most other projects go full minimized source. If footprint size is a concern there are fairly easy options for shipping projects to minimize things to their own specifications. Needing to pull the source and link isn't a great option.

@jdalrymple
Copy link
Owner

Thats fair, what would you two suggest?

@Dianoga
Copy link

Dianoga commented Sep 3, 2020

I did some searching this morning to see how other projects handle it and the answer seems to be "it's complicated". There's a good discussion over here but no real resolution (googleapis/google-cloud-node#2867).

I think the thing that would have helped me the most is just not minimizing the source. That would let me do basic things like use a debugger and step through calls to see what's happening.

@jdalrymple
Copy link
Owner

Hmm, what if i just minified the browser version? I feel like the browser files are the ones most affected by package size.

@jdalrymple
Copy link
Owner

Or i could include the source maps

@Dianoga
Copy link

Dianoga commented Sep 7, 2020

If you're going to minify a version doing that just for the browser makes sense. But in a world where many projects make use of tools like webpack to assemble their final bundle you may not need to worry about minification. The only place where I think you would want that is if you were distributing the library via a CDN for simple script tag inclusion but I don't see that mentioned in the docs anywhere.

@jdalrymple
Copy link
Owner

jdalrymple commented Sep 28, 2020

Ive removed the minification in the latest builds for everything besides the browser release 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants