Support the chunkName method

Author: yanghuabeiCreated Jul 9, 2024Updated Jul 9, 2024

Feature Proposal

Add chunkName method to loadable component.

Motivation

Our page uses server-side rendering, and some loadable features need to be displayed immediately after the page loads. We hope to obtain the chunkName during server-side rendering and then preload resources.

Example

javascript

// server side
import { LoadablePopup } from './loadable'

const chunkName = LoadablePopup.chunkName();
const resources = collectResources(chunkName);
// Then insert link preload after body tag

Pitch

Why does this feature belong in the Loadable Component ecosystem?

Source: gregberge/loadable-components