I am using a monorepo, and have set up aliases in the config like so:
const modifyBundlerConfig = config => {
config.resolve.alias = Object.assign({}, config.resolve.alias, {
'@core': path.resolve(__dirname, '..', 'core'),
'@ui': path.resolve(__dirname, '..', 'ui'),
'@root': path.resolve(__dirname, '../../'),
'@intl': path.resolve(__dirname, '..', 'intl')
});
return config;
};
When I try to import and use a README from the @root of the project:
import Readme from '@root/README.md';
<Readme />
It fails to parse the markdown, giving me the error:
Module parse failed: Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
This actually occurs for any files outside the directory that Docz is in, not just markdown files but also tsx. It seems it does not work to have docz in its own directory.
We have some files that are ignoring by default on docz:
const ignore = [
'readme.md',
'changelog.md',
'code_of_conduct.md',
'contributing.md',
'license.md',
]
But we have an option called ignore as config that you can change the default option:
// doczrc.js
export default {
ignore: []
}
Try to change this options and see what's happening.
I still have the same problem.
I also have the same problem if I try to import any component from outside the docz package.
The directory structure is like this:
- README.md
- packages
|-- docs
|-- ui
|-- core
docz lives in the docs package. If I try to import the README from the root, or a component from ui, I get the error
Module parse failed: Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
If I move docz to the root, I don't have the issue.
Oh for sure, you're trying to load content outside docz, this isn't possible. Was a decision that we'd some time ago about some architecture and performance issues. I really advise you to put docz on your root directory as a devDependency of your monorepo, I'm doing this in a project from my work and works well.
@pedronauck Thanks for answering! I think that "trying to load content outside docz isn't possible" should have more emphasis in the docs, as I had to search for this issue to find why my documentation couldn't be built.
Most helpful comment
@pedronauck Thanks for answering! I think that "trying to load content outside docz isn't possible" should have more emphasis in the docs, as I had to search for this issue to find why my documentation couldn't be built.