Docz: Not working with `next/babel` preset

Created on 24 Jul 2018  路  5Comments  路  Source: doczjs/docz

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 [email protected] [email protected] [email protected]
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
bug

Most helpful comment

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": []
}

All 5 comments

Same Problem trying to implement docz with Nextjs - same versions

I found a solution based on #20.
For this case using next.js I created a empty babel.json file, docz assume as babel default configuration and insert babel-preset-react-app.

babel.json:
{ "presets": [], "plugins": [] }
That works for me @RafalFilipek

Fixed on v0.9.0 馃殌

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": []
}

Actually, i've just finished some further tests. I was using several babel 6 packages. I know that exists a plugin to enable docz run in babel 6 but i wasn't using it and that's why i was getting this error.

So, the case is:
If you're using Babel 6 and didn't configured the plugins correctly, you may fix your project just creating this babel.json file.

I'm my case i've just updated my packages project to babel 7 and removed this file and everything it's running smooth.

I think that everyone with these errors is related with babel 6 without correct configuration.

Was this page helpful?
0 / 5 - 0 ratings