Not able to use unplugin-macros with svelte kit
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
unplugin-macros works with vite-plugin-svelte but not with sveltekit.
Reproduction
demo with vite-plugin-svelte: https://stackblitz.com/edit/vitejs-vite-jnfp883g
demo with sveltekit: https://stackblitz.com/edit/sveltejs-kit-template-default-varswkuh
run pnpm build and search for console.log in the build files: you should find a random number with console.log() instead of getRandom()
console.log(.8932386624955339)
as getRandom() is run during compilation.
console.log(_l())
Logs
System Info
stackblitz
Severity
annoyance
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked SvelteKit and vite-plugin-svelte StackBlitz reproductions, run pnpm build, and compare the generated files for the console.log output. Trace why getRandom() is compiled in the Vite reproduction but remains in the SvelteKit build; done means the SvelteKit build produces the same transformed output as the working reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100