Have you read the Contributing Guidelines on issues?
Prerequisites
Description
For corporate reasons™ I need to store the blog posts in a subdirectory of the docs (actually, in my specific case, docs path = '..', and blog path = '../release_notes', but I can reproduce the bug without '..' in the paths for a more standard installation).
The build fails with a kinda weird error.
Reproducible demo
No response
Steps to reproduce
npx create-docusaurus@latest my-website classic --typescript
cd my-website
mv blog docs
Then patch docusaurus.config.ts:
- Add the line
exclude: ['blog'], in the docs preset
- Add the line
path: 'docs/blog', in the blog preset
Then yarn build.
Expected behavior
A perfectly indistinguishable build from the example
Actual behavior
A bunch of those errors:
lient bundle compiled with errors therefore further build is impossible.
Error: MDX compilation failed for file "/home/felix/tmp/my-website/docs/blog/2019-05-28-first-blog-post.md"
Cause: Unexpected `FunctionDeclaration` in code: only import/exports are supported
Details:
{
"column": 1,
"file": "",
"message": "Unexpected `FunctionDeclaration` in code: only import/exports are supported",
"line": 24,
"name": "24:1-33:2",
"place": {
"start": {
"line": 24,
"column": 1,
"offset": 564
},
"end": {
"line": 33,
"column": 2,
"offset": 778
}
},
"reason": "Unexpected `FunctionDeclaration` in code: only import/exports are supported",
"ruleId": "non-esm",
"source": "micromark-extension-mdxjs-esm",
"url": "https://github.com/micromark/micromark-extension-mdxjs-esm#unexpected-type-in-code-only-importexports-are-supported"
}
--------------------------
Your environment
- Docusaurus version used: 3.9.2
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Nodejs 22.21.0
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): Ubuntu 24.04
Self-service
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clearoryarn clearcommand.rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages.Description
For corporate reasons™ I need to store the blog posts in a subdirectory of the docs (actually, in my specific case, docs path = '..', and blog path = '../release_notes', but I can reproduce the bug without '..' in the paths for a more standard installation).
The build fails with a kinda weird error.
Reproducible demo
No response
Steps to reproduce
Then patch
docusaurus.config.ts:exclude: ['blog'],in the docs presetpath: 'docs/blog',in the blog presetThen
yarn build.Expected behavior
A perfectly indistinguishable build from the example
Actual behavior
A bunch of those errors:
Your environment
Self-service