futtta / autoptimize

Official Autoptimize repo on Github
https://autoptimize.com/pro/
GNU General Public License v2.0
283 stars 87 forks source link

Sourcemap generation #383

Closed fliespl closed 3 months ago

fliespl commented 2 years ago

I am curious if it's possible to add sourcemap generation when minifying and combining files?

Might be worthy as an addition when using monitoring system like rollbar (which would make it possible to troubleshoot issues more easily than with minified content):

https://ss.codeone.pl/ss-2022-05-20-22-16-46-1653077806-IrkWsUSH.png

futtta commented 2 years ago

It should be possible, but given how easy it is to load the page without being autoptimized (by adding ?ao_noptimize=1 to the URL) this is pretty low on my priority list really.

fliespl commented 2 years ago

I understand being low on priority list (and that's fine).

I would like to give some additional comment to adding ?no_autoptimize, which I of course utilize when needed, but is not a solution in the use case I have described.

When it comes to monitoring software (rollbar/sentry). Those are mostly used on production systems to notify website owners about errors that happened to visitors (specific url/action/browser).

This means - they will always be with served with minified content (because we want that on production systems). Source maps would make it possible for such tools to correctly pinpoint errors in unminified scripts.

Currently it's really hard since it mentions line 1, cause that's the only line in most cases :)

futtta commented 2 years ago

use case understood. if ever you want to help on this ping me here and I'll be happy to guide you/ provide feedback/ review and eventually merge a PR :-)

On 21/05/2022 21:07, fliespl wrote:

I understand being low on priority list (and that's fine).

I would like to give some additional comment to adding |?no_autoptimize|, which I of course utilize when needed, but is not a solution in the use case I have described.

When it comes to monitoring software (rollbar/sentry). Those are mostly used on production systems to notify website owners about errors that happened to visitors (specific url/action/browser).

This means - they will always be with served with minified content (because we want that on production systems). Source maps would make it possible for such tools to correctly pinpoint errors in unminified scripts.

Currently it's really hard since it mentions line 1, cause that's the only line in most cases :)

— Reply to this email directly, view it on GitHub https://github.com/futtta/autoptimize/issues/383#issuecomment-1133753505, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABMIMKPO7YWRGW4CRNQ47LVLEX65ANCNFSM5WQPB7JA. You are receiving this because you commented.Message ID: @.***>

fliespl commented 2 years ago

If you could just point me into proper direction, I would appreciate that :) I am working mostly as BE dev/SysAdmin, so not really familiar with all frontend stuff. Are there any libs, I can look at?

futtta commented 2 years ago

https://github.com/koala-framework/sourcemaps could be useful (maybe others). and you would need to call that somewhere around https://github.com/futtta/autoptimize/blob/beta/classes/autoptimizeScripts.php#L362-L365 probably.

On 21/05/2022 21:41, fliespl wrote:

If you could just point me into proper direction, I would appreciate that :) I am working mostly as BE dev/SysAdmin, so not really familiar with all frontend stuff. Are there any libs, I can look at?

— Reply to this email directly, view it on GitHub https://github.com/futtta/autoptimize/issues/383#issuecomment-1133758063, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABMIMJEZIH2TLRV7AAOLW3VLE37XANCNFSM5WQPB7JA. You are receiving this because you commented.Message ID: @.***>

fliespl commented 2 years ago

After 1h of checking, I get it now, why it's low on priority list :)

Your proposed library won't work since it would require a lot of custom coding.

I think (haven't tested) that switching to some other css/js minification library might be more promising (found this one: https://github.com/wikimedia/minify) and then adjust lines with final code. Don't know if possible, but hopefully will look into it when I have some free time.

futtta commented 2 years ago

So wikimedia's minify has builtin support for sourcemaps you mean?

fliespl commented 2 years ago

It seems that way, but it's recent addition and haven't tested it, so will let you know once I get to it :)

fliespl commented 2 years ago

Also looked at this one (as standalone now - not part of the library) - will take some time to propose PR since this change is also not immediate one and requires some more testing.