Open SoonIter opened 1 month ago
we need to rename the top-level variables when merging two mdx files to solve this issue
I can‘t reproduce the first case, is it correct?
I can‘t reproduce the first case, is it correct?
I'm sure
You can checkout https://github.com/SoonIter/rspress-mdx-flatten/tree/case_1 and https://github.com/SoonIter/rspress-mdx-flatten/tree/case_2
I'm sure
You can checkout https://github.com/SoonIter/rspress-mdx-flatten/tree/case_1 and https://github.com/SoonIter/rspress-mdx-flatten/tree/case_2
I got what you mean. The first case did not directly use the <a />
, which caused me to misunderstand.
Version
Details
Rspress uses
flattenMdxContent
to inline one mdx to another mdx file. However, this function currently has some bugs.https://github.com/web-infra-dev/rspress/blob/5121cac6cdc08cc58ed613347d43d48cf90dcc3d/packages/core/src/node/utils/flattenMdxContent.ts#L59
case 1
rspress uses
flattenMdxContent
to inline "a.mdx" into "index.mdx" for better analysisCase 2
same error
Possible Solution
We need to refactor this function and find the best solution to combine two mdx fragments into one, just like concatenation module or scope hoisting
https://webpack.js.org/plugins/module-concatenation-plugin/#root
Reproduce link
https://github.com/SoonIter/rspress-mdx-flatten
Reproduce Steps