You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The storysource plugin is rendering transpiled code, outputting in es5, no JSX, no TS.
I have included repro link with my main.ts config ported over mostly as-is. I've tried dozens of ways to configure main.ts to get this plugin to work with this setup, to no avail.
importReactfrom'react';import{jsxas_jsx}from"react/jsx-runtime";varmeta={title: 'Example/Page',// component: Page,parameters: {// More on how to position stories at: https://storybook.js.org/docs/configure/story-layoutlayout: 'fullscreen'}};exportdefaultmeta;exportvarBasicExample={// do not pass "activeKeys" from props to avoid switching to controlledrender: functionrender(){return/*#__PURE__*/_jsx("div",{children: "Hello world"});}};
expected:
exportconstBasicExample={// do not pass "activeKeys" from props to avoid switching to controlled// eslint-disable-next-line unused-imports/no-unused-varsrender: ()=><div>Hello world</div>,};
System
this command simply outputs this:
js (reshaped-4|✚2) npx storybook@latest info
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
js (reshaped-4|✚2) npx storybook@latest info
Need to install the following packages:
[email protected]
Ok to proceed? (y)
Additional context
No response
The text was updated successfully, but these errors were encountered:
** Disclaimer** This information might be inaccurate, due to it being generated automatically
The storysource addon's transpilation behavior is controlled by the loaderOptions parameter in the addon configuration. To show untranspiled source code: 1. In your .storybook/main.ts, modify the addon-storysource configuration: ts { addons: [ { name: '@storybook/addon-storysource', options: { loaderOptions: { prettierConfig: { parser: 'typescript' }, injectStoryParameters: true, parser: 'typescript' } } } ] } The relevant code for this configuration is in code/addons/storysource/src/loader.ts which handles the source transformation.
About Greptile
This response provides a starting point for your research, not a precise solution.
Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
I updated my stackblitz with above suggestion. though the output is slightly better, it still does not render as expted:
{// do not pass "activeKeys" from props to avoid switching to controlledrender: functionrender(){return/*#__PURE__*/_jsx("div",{children: "Hello world"});}}
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
The storysource plugin is rendering transpiled code, outputting in es5, no JSX, no TS.
I have included repro link with my main.ts config ported over mostly as-is. I've tried dozens of ways to configure main.ts to get this plugin to work with this setup, to no avail.
Reproduction link
https://stackblitz.com/edit/github-qarthtnv?file=src%2Fstories%2FHeader.stories.ts
Reproduction steps
Actual:
expected:
System
Additional context
No response
The text was updated successfully, but these errors were encountered: