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
|
||||
|
||||
Reference in New Issue
Block a user