-
-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Clear and concise description of the problem
If we return a lot of data from a macro (for example, due to the use of fetch) and use it in different ones, then the data will constantly be duplicated.
Now I have to use two files to avoid duplication of data. Example:
/* src/config/data.ts */
import { data as $data, data2 as $data2 } from "../macros/data" with { type: "macro" };
export const data = $data;
export const data2 = $data2;/* src/macros/data.ts */
import { $fetch } from "ofetch";
const { data, data2 } = await $fetch("https://example.app/items/");
export { data, data2 };Suggested solution
It is possible to create a virtual module instead of directly replacing data in the AST in certain scenarios. For example, if the macro does not return functions
Alternative
I will be happy to consider any alternative solutions to my problem.
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request