[Bug?]: unplugin-macros doesn't work
Duplicates
- [x] I have searched the existing issues
Latest version
- [x] I have tested the latest version
Current behavior 😯
lib/test.ts:
export function getRandom() {
return Math.random();
}
export const buildTime = Date.now();
routes/test.ts:
import { buildTime, getRandom } from "../lib/test.ts" with { type: "macro" };
export function GET() {
return getRandom();
}
console.log(buildTime);
when you go to /test you'll see a different value every time.
Expected behavior 🤔
its supposed to be the same value every time, since its a macro.
config:
import Macros from "unplugin-macros/vite";
import { defineConfig } from "@solidjs/start/config";
export default defineConfig({
vite: {
plugins: [Macros()],
},
});
Steps to reproduce 🕹
i couldn't reproduce in vinxi. this bug is only in solidstart.
Context 🔦
No response
Your environment 🌎
this is because of how api routes are imported under the hood by solid start, with a ?pick=GET (or ?pick=POST) query.
Do you have suggestions how to handle this? I assume its uncompatible right now
Do you have suggestions how to handle this? I assume its uncompatible right now
we need a way to import routes without a query. sveltekit does this. i don't know how tho