I want to import dynamically React Typescript Component from wildcard path like below:-
const Component = loadable(
() => import(`../../../src/**/*/${component_name}`),
);
Is it possible to import like above using a wildcard?
Lots of solutions found in Stackoverflow but nothing match with the requirement.
Any help will highly appreciate.
You should use React.lazy and Webpack require
This solution may require restart Webpack after each new component that you add to components folder. Component names (aka fileNames in our case) should be uniq. React.lazy required default export
Solution based on: