import.meta.globEager #7066
Unanswered
Red-xiaoshami
asked this question in
Q&A
Replies: 3 comments 1 reply
-
me too using webpack TypeError: {}.globEager is not a function |
Beta Was this translation helpful? Give feedback.
0 replies
-
Checkout this section in the Vite docs. I followed the instructions, restarted TS server in VSCode and now the types are available :D |
Beta Was this translation helpful? Give feedback.
0 replies
-
const modulesFiles = import.meta.glob("../api/*.js",{ eager: true }) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
import.meta.globEager,method types in imported files are missing when using typescript,How to solve it?
index.ts
import { LOGIN_TYPE } from "./index.type";
export default {
login: (data: LOGIN_TYPE) => {
return axios.post("user/login", data);
},
exit: (data: LOGIN_TYPE) => {
return axios.post("user/exit");
},
};
code:
const asyncRoutersFiles = import.meta.globEager("./*/index.ts");
const postsMetadata = Object.entries(asyncRoutersFiles).map(
([path, module]) => {
return module.default;
}
);
export default postsMetadata[0];
Beta Was this translation helpful? Give feedback.
All reactions