Have you read the Contributing Guidelines on issues?
Prerequisites
Description
If I add the docs plugin to the list of plugins (multi-instance) and I point it to the same folder that the preset is already pointing to (docs by default), the build process stops working and I see the following errors:
SyntaxError: /code/src/......../index.mdx: Identifier 'React' has already been declared. (46:184)
I believe the bug might be caused by the way each mdx file is being processed. Because a mdx file is (basically) a JSX file, import React from 'react'; is being prepended at the top of each file. But since I have two instances of the docs plugin pointing to the same folder, the import statement is being prepended twice (hence the error).
I made a minimal repro codesandbox.
Reproducible demo
https://codesandbox.io/s/trusting-rosalind-sc4s15
Steps to reproduce
- Open the link
- Open a new tty and type
npm run build
- The build will fail.
- Comment the
plugins section of the docusaurus.config.js
- Run
npm run build again.
- The build will succeed.
Expected behavior
I should be able to point multiple instances of the docs plugin to the same folder.
Actual behavior
The build crashes.
Your environment
- Public source code: N/A
- Public site URL: N/A
- Docusaurus version used: 2.0.0-beta20
- Environment name and version (e.g. Chrome 89, Node.js 16.4): N/A
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): N/A
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
If I add the docs plugin to the list of plugins (multi-instance) and I point it to the same folder that the preset is already pointing to (
docsby default), the build process stops working and I see the following errors:I believe the bug might be caused by the way each mdx file is being processed. Because a mdx file is (basically) a JSX file,
import React from 'react';is being prepended at the top of each file. But since I have two instances of the docs plugin pointing to the same folder, theimportstatement is being prepended twice (hence the error).I made a minimal repro codesandbox.
Reproducible demo
https://codesandbox.io/s/trusting-rosalind-sc4s15
Steps to reproduce
npm run buildpluginssection of thedocusaurus.config.jsnpm run buildagain.Expected behavior
I should be able to point multiple instances of the docs plugin to the same folder.
Actual behavior
The build crashes.
Your environment
Self-service