-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module build failed with MDX files: Unexpected token #9996
Comments
@Benwick91 can you bisect to figure out exactly which version broke it? From there I can more easily help diagnose exactly what's going wrong. |
@shilman Thank for your answer. There happens something weird. If I update from a version, that runs without problems, the update works (5.3.9 til 6.0.0.alpha20). But if I delete the node-modules folder and make a new yarn install, the MDX error occurs. And I can install another version (even 5.3.9) and it doesn't work anymore. One strange thing is that in the yarn.lock there are two node-logger versions (5.3.9 and 5.3.14) after the update |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Not sure if this is helpful, but for me the difference between the error above and a working config was this: use: [
+ {
+ loader: 'babel-loader',
+ // may or may not need this line depending on your app's setup
+ options: {
+ plugins: ['@babel/plugin-transform-react-jsx'],
+ },
+ },
{
loader: '@mdx-js/loader',
options: {
compilers: [createCompiler({})],
},
},
], I can see it doesn't resemble your config at all, but maybe it would help someone knowledgable such as @shilman to understand where the error comes from. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Same thing happened on version |
Have you tried the docs preset with module.exports = {
stories: ['../src/**/*.stories.(js|mdx)'],
addons: [
{
name: '@storybook/addon-docs',
options: { configureJSX: true },
},
],
}; |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
I've the same issue |
I'm seeing the Here is my
|
Getting this error when trying to add second story in one
Config is almost the same as @alexnitta has. |
@nevolgograd delete the whitespace between |
@shilman would never have thought of this, thanks! |
same error occurs when updating updateStill have error in @storybook/preset-create-react-app@3.1.0 Maybe this is related 🤔 ? update:2My problem solved upgrade storybook v6.0.0-beta.37 to v6.0.0-beta.38 |
Hit this same issue when running through the Controls walkthrough https://gist.github.com/shilman/69c1dd41a466bae137cc88bd2c6ef487#:~:text=Storybook%20Controls%20w%2F%20CRA%20%26%20TypeScript,ergonomic%20way%20to%20write%20stories. |
I am having the same issue when migrating from version 5.3.x to 6.0.x via the migration guide here |
I'm getting the same issue after following a basic example on Storybook tutorials. Tried the following:
I'm getting a main.js
test.stories.mdx
Test.js
package.json
|
@daniel-norris whitespace is important in MDX. extra blank lines can cause problems, per the issue you referenced. but missing blank lines can too. for instance i'm pretty sure you are missing required blank lines around the JSX snippets and headings. MDX 2.0 will hopefully be released in the next few weeks, in concert with Storybook 6.0, and hopefully that will address some of these issues, or at least give new clarity on the rules. |
@shilman thanks for the reply. Is there an example repo or boilerplate I can look at for correct mdx usage with storybook? |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Sorry for the slow reply on this. Lots of valid Storybook MDX files here: https://github.com/storybookjs/storybook/tree/next/examples |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook! |
This is a long shot, but I'm hoping someone who's more familiar with MDX's intricacies might be able to help me pinpoint my error. I've gone line by line and manually checked by deleting code and checking for output and have only been able to successfully get my MDX story to display when I remove everything but the final I tried adding Here's my entire warning:
Along with the code that is causing it from theme.stories.mdx:
|
@coreybruyere a couple different thoughts:
|
I tried removing my babel config and was still seeing the same issue. If you get a chance could you possibly take a look at a simplified version of my library? It contains the same config as my private repo. Stories break when the code is present inside of Any pointers or help would be greatly appreciated |
Hello everyone, I'm also facing the same issue, & I can't figure out what's wrong export const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const [value, setValue] = useState<string>("")
setValue(e.target.value)
} & just rendering it inside a <Canvas>
<Story
name="Text"
args={{
label: "Search",
variant: "outlined",
type: "text",
color: "primary",
height: 40,
placeholder: "placeholder",
onChange: handleChange,
value: value
}}
>
{Template.bind({})}
</Story>
</Canvas>
|
Sorry for writing in and old closed thread. Just had this issue, but solved it by replacing:
as described in the docs here. Now when you start the storybook server and open it (usually on http://localhost:6006/), you can now see the full error in the console, not just "Unexpected token" (the full error will not be displayed in your terminal). You can also run Other errors was:
When I removed all those. It compiled fine. Hope this fixed can help someone else too. |
Describe the bug
My mdx files fail after upgrade to Storybook version 5.3.14. In Storybook 5.3.9 everything works fine. I have no empty lines in my MDX files.
Expected behavior
The building of my mdx files.
Code snippets
Here my main.js and my webpack.config.js. I get it only work in 5.3.9 with both files. perhaps here is the problem.
My main.js:
My webpack.config.js:
System:
Environment Info:
Additional context
Thank you!
The text was updated successfully, but these errors were encountered: