Open
Description
We have a component library. We are trying to load a component with dynamic name. It doest work when i try to load it from node_modules, but it works when i try to load local files
This guy works
const AsyncComponent = loadable(
(props) => {
return import(`./${props.icon}`)
}
);
This guy doesnt work
const AsyncComponent = loadable(
(props) => {
return import(`@amazing/componentlib/${props.icon}`)
}
);
So my question is, is it possible to load dynamically files from node_modules ?
(doing it in nextjs)
Also, to make clear, the problem is with dynamically constructed imports, this guy, works without problems:
const AsyncComponent = loadable(
props =>
import(`@amazing/componentlib/IconAirplane`)
)