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.

Not working with `next/babel` preset

See original GitHub issue

Bug Report

Looks like there is some kind of configs collision with next/babel (Next.js preset) preset. When it’s enabled, Whoops, we crashed error is shown.

To Reproduce

mkdir next-docz-test
cd next-docz-test
yarn init -y
yarn add -E docz@0.7.1 next@6.1.1 react@16.4.1
echo '{"presets": ["next/babel"]}' > .babelrc
echo '---\nname: Index\nroute: \/\norder: 1\n---\n# Hello' > index.mdx
yarn docz dev
open http://localhost:3000

Stacktrace

Element type is invalid: expected a string (for built-in components) 
or a class/function (for composite components) but got: undefined. 
You likely forgot to export your component from the file it's defined in, 
or you might have mixed up default and named imports.
Check the render method of Component.
in Component (created by n)
in n (created by t)
in div (created by Container)
in Container
in div (created by Wrapper)
in Wrapper
in div (created by Wrapper)
in Wrapper (created by Main)
in Main
in ThemeConfig (created by Page)
in Page (created by t)
in t
in t
in p (created by DocPreview)
in DocPreview
in c
in ThemeProvider
in ThemeConfig (created by Theme)
in Theme (created by DoczTheme)
in DefaultWrapper (created by DoczTheme)
in t (created by t)
in t (created by DoczTheme)
in ErrorBoundary (created by DoczTheme)
in DoczTheme (at root.jsx:30)
in Root (created by HotExportedRoot)
in AppContainer (created by HotExportedRoot)
in HotExportedRoot (at index.jsx:16)

Enviroment

  • Docz: 0.7.1
  • Next: 6.1.1
  • React 16.4.1
  • OS: OSX 10.13.4
  • Node / npm / yarn: 8.9.4 / 5.6.0 / 1.6.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
pedronauckcommented, Aug 2, 2018

Fixed on v0.9.0 🚀

2reactions
wallynmcommented, Aug 16, 2018

I’m using "docz": "^0.10.3"and the same problem was solved using the @jhta babel.json empty file. I think this bug still going on.

This babel.json fixed the error!

{
  "presets": [],
  "plugins": []
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Features: Customizing Babel Config - Next.js
Customizing Babel Config ... Next.js includes the next/babel preset to your app, which includes everything needed to compile React applications and server-side ...
Read more >
Parsing error : Cannot find module 'next/babel' - Stack Overflow
js project that I create. The page can be compiled without any problem, it just keeps on showing as error on the first...
Read more >
Babel config is not used (preset-react) #22496 - GitHub
I had a similar problem - babel.config.js was detected by next but wasn't used. I followed this #19334 (comment) reply and it worked....
Read more >
Config Files - Babel.js
The primary downside of this project-wide config is that, because it relies on the working directory, it can be more painful to use...
Read more >
Adding Babel presets and plugins in Next.js - Netlify
Want to add useful, fun, or experimental plugins and presets to your Next.js projects? Here's how!
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