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

hope allow @require url support Data URLs #1084

Closed
lisonge opened this issue Aug 29, 2022 · 9 comments
Closed

hope allow @require url support Data URLs #1084

lisonge opened this issue Aug 29, 2022 · 9 comments

Comments

@lisonge
Copy link

lisonge commented Aug 29, 2022

// ==UserScript==
// @name               example
// @namespace          https://github.com/lisonge
// @version            1.0.1
// @author             lisonge
// @match              https://i.songe.li/
// @require            https://cdn.jsdelivr.net/npm/vue@3.0.0/dist/vue.global.prod.js
// @require            data:application/javascript,%3Bwindow.Vue%3DVue%3B
// @require            https://unpkg.com/element-plus@2.2.15/dist/index.full.js
// ==/UserScript==

// `data:application/javascript,` + encodeURIComponent(`;window.Vue=Vue;`)

because vue use iife export, element-plus use umd, they can not both work in Tampermonkey/Violentmonkey window scope

full detail see vite-plugin-monkey#5

The simplest solution is that add a @require url to set window.Vue to scope.Vue after vue require url

@JasonBarnabe
Copy link
Collaborator

I don't understand the purpose of this. Can you explain further? Is this something already supported by user script managers like Tampermonkey?

@lisonge
Copy link
Author

lisonge commented Aug 30, 2022

Tampermonkey/Violentmonkey support // @require data:application/javascript,%3Bwindow.Vue%3DVue%3B

@lisonge
Copy link
Author

lisonge commented Aug 30, 2022

image
image

can not work

@lisonge
Copy link
Author

lisonge commented Aug 30, 2022

image
image

can work

@lisonge
Copy link
Author

lisonge commented Aug 30, 2022

image

but // @require data:application/javascript,%3Bwindow.Vue%3DVue%3B is not allowed at greasyfork

@lisonge
Copy link
Author

lisonge commented Aug 30, 2022

Do you understand what I mean ?

@lisonge
Copy link
Author

lisonge commented Sep 2, 2022

@JasonBarnabe hello, Could you please give me an accurate reply?

JasonBarnabe added a commit that referenced this issue Sep 3, 2022
@JasonBarnabe
Copy link
Collaborator

data URI @requires are now allowed.

@lisonge
Copy link
Author

lisonge commented Sep 3, 2022

ok, thanks

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

No branches or pull requests

2 participants