WebpackError: TypeError: Cannot read property 'replace' of undefined
See original GitHub issueHi everybody !
I donβt know exactly if itβs a bug or if itβs a weird behavior for me ^^
I am developing a Gatsby website, and I want to use markdown-to-jsx in.
I have to pull some data, map some arrays⦠and use Markdown to print text on my website.
The problem is Markdown doesnβt accept empty field : <Markdown></Markdown>
But, what I want to do that ?
Because I donβt want to check all times if there is a text in my variable or not :
<Markdown>MyArray[0].Variable1.text</Markdown>
I just want to it to print nothing if there is nothing π
My logs :
2:28:33 PM: 2 | //# sourceMappingURL=index.module.js.map
2:28:33 PM: 3 |
2:28:33 PM:
2:28:33 PM: WebpackError: TypeError: Cannot read property 'replace' of undefined
2:28:33 PM:
2:28:33 PM: - index.module.js:1
2:28:33 PM: node_modules/markdown-to-jsx/dist/index.module.js:1:14571
2:28:33 PM:
2:28:33 PM: - index.module.js:1
2:28:33 PM: node_modules/markdown-to-jsx/dist/index.module.js:1:15150
2:28:33 PM:
2:28:33 PM:
2:28:33 PM: not finished Generating image thumbnails - 133.828s
2:28:33 PM: β
2:28:33 PM: βββββββββββββββββββββββββββββββ
2:28:33 PM: β "build.command" failed β
2:28:33 PM: βββββββββββββββββββββββββββββββ
2:28:33 PM: β
2:28:33 PM: Error message
2:28:33 PM: Command failed with exit code 1: gatsby build
2:28:33 PM: β
2:28:33 PM: Error location
2:28:33 PM: In Build command from Netlify app:
2:28:33 PM: gatsby build
Is it a bug or it is normal ?
Thank you everybody !
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
js: TypeError: Cannot read property 'replace' of undefined using
I wanted to replace /\r?\n|\r/g with empty string but got a type error "Cannot read property 'replace' of undefined".
Read more >Next 10.0.6 with webpack 5 & custom server throws `Cannot ...
Next 10.0.6 with webpack 5 & custom server throws Cannot read property 'replace' of undefined #21703.
Read more >TypeError: Cannot read property 'replace' of Undefined in JS
The "Cannot read property 'replace' of undefined" error occurs when calling the replace() method on a variable that stores an undefined value.
Read more >Uncaught TypeError: Cannot read property 'replace' of ...
Uncaught TypeError: Cannot read property 'replace' of undefined from line 248 of ytprefs.min.js. I can't seem to figure out what's causing it or...
Read more >Webpack Error: Cannot read property .toWebpackConfig of ...
TypeError : Cannot read property 'toWebpackConfig' of undefined at Object. ... Gemfile gem 'webpacker', '~> 6.x' # replace '.x' with whichever version isΒ ......
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 Free
Top 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
Hi !
I am coming back on this bug. I had a similar error today :
WebpackError: TypeError: t.replace is not a function
Only because I forget a space in my Markdown tag :
<Markdown> {TitlePlateforme || ""}</Markdown>
( between the<Markdown>
and the{Title...
)Maybe you should prevent this too ? π
Have a good day !
I think you should create a separate component:
And replace all Markdown component use with YourMarkdown