渲染MDX时如何减少Gatsby中的___chunkMapping?

问题描述 投票:0回答:0

现在我有大约 50 页,每页都有 4 种语言的翻译。

我以编程方式创建页面。根据 documentation,我必须以这种形式为每个页面指定组件的路径

src/templates/Page.tsx?__contentFilePath=...
添加唯一的 __contentFilePath 后缀。

这将为每个页面创建一个组件文件(如

component---src-templates-page-tsx-content-file-path-src-content-about-en-mdx-0a71508e3b2d066e3c89.js
)并将其放入
___chunkMapping
数组中。

但这会导致生成的 html 文件中的

___chunkMapping
大幅增加。内容本身要小得多。

遇到这种情况该怎么办?如果有数千页怎么办?

gatsby gatsby-plugin-mdx
© www.soinside.com 2019 - 2024. All rights reserved.