Cannot import README.md in monorepo
See original GitHub issueImporting and using markdown files as components does not work as expected.
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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Import markdown.md for notes "Cannot find module" #6434
Describe the bug I want to use the notes addon to display relevant information about my component using markdown, see code below. import...
Read more >reactjs - Error when importing JSX files from another package ...
However I am not able to import a component from another package. When I import a common function, no error occurs. Github repository....
Read more >Setup a Monorepo with PNPM workspaces and speed it up ...
In this article we're going to have a deep dive into setting up a new monorepo using PNPM workspaces that hosts a Remix...
Read more >Internal Packages - Turborepo
+ import { add } from "math-helpers"; + add(1, 2);. You'll likely see an error! Cannot find module ...
Read more >Working with monorepos - Expo Documentation
Learn about setting up Expo projects in a monorepo with Yarn v1 workspaces. Monorepos, or "monolithic repositories", are single repositories containing multiple ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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.