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.

toJSX does not have a default for `options.file`

See original GitHub issue

Subject of the issue

After the most recent release, Storybook will not build and returns this error:

WARN ./src/components/Box/Box.stories.mdx
WARN Module build failed (from ./node_modules/@mdx-js/loader/index.js):
WARN TypeError: Cannot read property 'path' of undefined
WARN     at Function.toJSX (project/node_modules/@storybook/addon-docs/node_modules/@mdx-js/mdx/mdx-hast-to-jsx.js:124:30)
WARN     at extractExports (project/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js:396:29)
WARN     at Compiler (project/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js:454:14)
WARN     at Function.stringify (project/node_modules/unified/index.js:354:12)
WARN     at pipelineStringify (project/node_modules/unified/index.js:41:18)
WARN     at wrapped (project/node_modules/trough/wrap.js:25:19)
WARN     at next (project/node_modules/trough/index.js:57:24)
WARN     at done (project/node_modules/trough/wrap.js:55:16)
WARN     at done (project/node_modules/unified/index.js:35:7)
WARN     at done (project/node_modules/unified/index.js:314:11)
WARN     at next (project/node_modules/trough/index.js:59:14)
WARN     at done (project/node_modules/trough/wrap.js:55:16)
WARN     at then (project/node_modules/trough/wrap.js:62:5)
WARN     at wrapped (project/node_modules/trough/wrap.js:45:9)
WARN     at next (project/node_modules/trough/index.js:57:24)
WARN     at done (project/node_modules/trough/wrap.js:55:16)
WARN  @ ./src/components/Box sync nonrecursive ^\.\/(?:(?:Box\.stories\.mdx)$)$ ./Box.stories.mdx
WARN  @ ./.storybook/generated-entry.js
WARN  @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js ./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js ./.storybook/preview.js ./.storybook/generated-entry.js

This might be Storybook’s issue to solve, but it also seems as if there isn’t a defaulting occurring for options.file inside of toJSX() here, which was introduced in #1126.

Your environment

  • OS: OSX 10.15.5
  • Packages: @storybook/addon-docs ^5.3.13, @storybook/react ^5.3.13
  • Env: lerna + yarn

Steps to reproduce

  1. Have a .stories.mdx file in a storybook build
  2. execute the build-storybook script that Storybook ships with

Expected behaviour

Storybook builds

Actual behaviour

Storybook fails building with the above error

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:29 (14 by maintainers)

github_iconTop GitHub Comments

5reactions
silvenoncommented, Jul 17, 2020

Released 1.6.11 🚀

3reactions
RoachaelRoadmunkcommented, Jul 17, 2020

@silvenon tested with Storybook 5.3.19 I can confirm version 1.6.11 fixed the issue.

Same here! Thanks for your help everyone!

Read more comments on GitHub >

github_iconTop Results From Across the Web

React JSX: selecting “selected” on selected <select> option ...
React JSX: selecting “selected” on selected <select> option with default option have issues · But I'm facing issues with setting defaultValue .
Read more >
Documentation - JSX - TypeScript
json file. *Note: You can specify the JSX factory function to use when targeting react JSX emit with jsxFactory option (defaults to React....
Read more >
Strict Mode - React
StrictMode is a tool for highlighting potential problems in an application. Like Fragment , StrictMode does not render any visible UI.
Read more >
Complete Guide to Webpack Configuration for React
Each rule can have a test property that tests if a file should be acted upon by webpack. In our case we'll want...
Read more >
react-native-fs - npm
Done! No need to worry about manually adding the library to your project. ... isFile()) { // if we have a file, read...
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