greasyfork-org / greasyfork

An online repository of user scripts.

Home Page:https://greasyfork.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hope allow @require url support Data URLs

lisonge opened this issue · comments

// ==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

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

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

image
image

can not work

image
image

can work

image

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

Do you understand what I mean ?

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

data URI @requires are now allowed.

ok, thanks