Added webpack chunk name to imported mdx docs. Fixed animation chunk name

This commit is contained in:
Piotr Janosz
2019-08-20 13:11:15 +02:00
committed by fabioberger
parent 2bde5f7034
commit af2b8dfde5
2 changed files with 5 additions and 8 deletions

View File

@@ -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

View File

@@ -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,