Added webpack chunk name to imported mdx docs. Fixed animation chunk name
This commit is contained in:
committed by
fabioberger
parent
2bde5f7034
commit
af2b8dfde5
@@ -11,16 +11,13 @@ interface IAnimationLoaderProps {
|
||||
export const AnimationLoader: React.FC<IAnimationLoaderProps> = ({ name }) => {
|
||||
const container = React.useRef(null);
|
||||
|
||||
React.useEffect(
|
||||
() => {
|
||||
void loadAnimationAsync(name);
|
||||
},
|
||||
[container.current, name],
|
||||
);
|
||||
React.useEffect(() => {
|
||||
void loadAnimationAsync(name);
|
||||
}, [container.current, name]);
|
||||
|
||||
const loadAnimationAsync = async (name: string) => {
|
||||
try {
|
||||
const animationData = await import(/* webpackChunkName: "[request]Animation" */ `./${name}.json`);
|
||||
const animationData = await import(/* webpackChunkName: "animation/[request]" */ `./${name}.json`);
|
||||
|
||||
lottie.loadAnimation({
|
||||
container: container.current, // the dom element that will contain the animation
|
||||
|
||||
@@ -69,7 +69,7 @@ export const DocsPage: React.FC<IDocsPageProps> = props => {
|
||||
|
||||
const loadPageAsync = async (filePath: string) => {
|
||||
try {
|
||||
const component = await import(`mdx/${filePath}`);
|
||||
const component = await import(/* webpackChunkName: "mdx/[request]" */ `mdx/${filePath}`);
|
||||
|
||||
setState({
|
||||
...state,
|
||||
|
||||
Reference in New Issue
Block a user