Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 1.35 KB

README.md

File metadata and controls

25 lines (15 loc) · 1.35 KB

Sourcemap example

Vanilla userscript with Vite build.minify and build.sourcemap. The metablock stays readable; the body is minified.

The map is inlined as a data: sourceMappingURL. Offset includes the metablock and the CSS prelude. No sibling .map file.

Tampermonkey prepends two wrapper lines before @require and the userscript, so DevTools asks for a generated line two past the file. The default sourcemapTarget is tampermonkey and absorbs that. Set sourcemapTarget: 'violentmonkey' to keep the map aligned with the file. One inline map cannot be correct for both managers at the same time.

homepage + autoMetaUrls fill @updateURL / @downloadURL. They do not host the map.

icon: 'greasify.svg' is joined with homepage at header generation. The file lives in public/ for the HTML page; the manager fetches @icon from the Pages URL.

index.html + src/page.ts is a Vite page next to the userscript. pnpm dev serves it at /. pnpm build writes the page to dist/ alongside {fileName}.user.js. The install button reads the file from virtual:vite-userscript-plugin.

pnpm build

Install the userscript, click Throw, and open the stack in DevTools. It should land on src/counter.ts, not the IIFE.

pnpm dev

Install the printed *.dev.user.js URL. HTTPS and public/ notes: FAQ.