Import markdown.md for notes "Cannot find module"
See original GitHub issueDescribe the bug I want to use the notes addon to display relevant information about my component using markdown, see code below.
import mdNotes from './card.component.notes.md';
storiesOf('Atoms/Card', module)
.add('Default with notes', () => ({
component: CardComponent
}), {
notes: mdNotes
}
);
Unfortunatly this results in TS2307: Cannot find module './card.component.notes.md'.
To Reproduce Steps to reproduce the behavior:
- Create a new story
- Create a markdown file with some content
- Import markdown file in your story
- See error
Expected behavior Markdown file is included and content is correctly rendered in the notes tab.
Code snippets
card.component.notes.md
# Card component
This component uses the Angular Material library.
typings.d.ts
declare module '*.md' {
const content: string;
export default content;
}
tsconfig.json
"typeRoots": [
"node_modules/@types",
"node_modules/@types","./typings.d.ts"
],
System:
- OS: Windows 10 Pro
- Device: Lenovo Thinkpad
- Browser: Firefox
- Framework: Angular
- Addons: Notes
- Version: 5.0.5
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
import markdown.md for addons "Cannot find module" #2883
Issue details I want to use markdown.md with addons but I can't import it Steps to reproduce I got error import README1 from...
Read more >How to import markdown(.md) file in typescript - Stack Overflow
I'm in Angular 13. This works to a point. I get an error: Error: Module not found: Error: Can't resolve 'raw-loader'.
Read more >markdown-it - npm
Start using markdown-it in your project by running `npm i markdown-it`. ... on script load // Note, there is no dash in "markdownit"....
Read more >Getting Started | Markdown Guide
Markdown is a fast and easy way to take notes, create content for a website, and produce print-ready documents. It doesn't take long...
Read more >Wiki - GitLab Docs
GitLab wikis support Markdown, Rdoc, AsciiDoc, and Org for content. Wiki pages written in ... Cannot find the link to the wiki from...
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
I just opened a PR with a fix, just follow my changes https://github.com/storybooks/storybook/pull/6444/files
It works in every possible scenario for me, can you verify that?
typings.d.ts
in.storybook
files
in.storybook/tsconfig.json
This worked for me (https://stackoverflow.com/a/56659180/602860):
Create a
globals.d.ts
file in your root directory with the following code: