arrow_backBACK TO DRILLS
Black Beltsuspense-transitionsPREMIUM
React.lazy() with a Dynamic Template Literal Path
Code splitting silently fails to produce separate chunks for each page in this setup, even though the import resolves correctly at runtime.
REACT_MODULE // 0x42
function loadPage(pageName) {
return React.lazy(() =>
import(`./Pages/${pageName}/index.js`)
);
}
const DynamicPage = loadPage(selectedPageName);Why does the bundler fail to produce separate chunks here?