question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import README.md in monorepo

See original GitHub issue

Importing 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kripodcommented, Dec 31, 2018

@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.

2reactions
pedronauckcommented, Nov 19, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found