-
Notifications
You must be signed in to change notification settings - Fork 78
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
GM.xmlHttpRequest not resolvable without reconfiguring minify #166
Comments
what is your raw code, build config and product code |
So the code in question is https://greasyfork.org/en/scripts/472236-gm-fetch/code but lightly revised to work with GM.xmlHttpRequest only instead of GM_xmlhttprequest, which ensures it works on Greasemonkey too (besides Tampermonkey). build config
If you want a full printout let me know. Not sure what else you need? |
Can you provide the repository url to reproduce this issue? Or you can upload a repository zip file to the github comment section |
Please let me know if any issues reproducing the issue. (My way of invoking npm is a bit different but I think this is close enough you should be able to run with it). Attached a sample user.js with the default minify settings as well, for reference. I added some more specifics to the README in the zip as well. FWIW, the script I've attached seems to work on both Greasemonkey and Tampermonkey when minify customization is applied (the esbuild settings referenced earlier, which shouldn't be needed), and doesn't work when minify is run without customization (when the esbuild settings are commented out). If I use import GM_xmlhttpRequest instead it works in Tampermonkey (minify doesn't clobber) but it doesn't work in Greasemonkey (the function doesn't exist in Greasemonkey). Thanks! |
This is caused by grant: ['GM.xmlHttpRequest'], |
Thanks! That appears to resolve the issue. Happy to have the minify benefits and I don't require autoGrant to work here. That's good enough for me. That said, is there something fixable in autoGrant here? I would suspect others running into this issue might not expect to look there (unless they happen upon this issue link). |
@blakehurd Hi, I'm the maintainer of the said script ( |
close lisonge#166
Thanks for the plugin, it remains useful!
The default minify ON settings appear to clobber the following:
Is this intentional? By clobber, I mean these references resolve to "undefined" in Greasemonkey and Tampermonkey, instead of resolving to 'stream' and the appropriate xhr function.
When I add this configuration to Vite, then it works:
esbuild: { minifyIdentifiers: false, keepNames: true, },
But it doesn't minify as completely as it could. Ideally this would work with default minify.
The text was updated successfully, but these errors were encountered: