Skip to content
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

[Bug]: Next JS addon shows errors using compiled .js instead of original .ts #26664

Open
anthonyma94 opened this issue Mar 27, 2024 · 2 comments

Comments

@anthonyma94
Copy link

anthonyma94 commented Mar 27, 2024

Describe the bug

When using the Next JS addon, any errors will use the compiled main.js as the source instead of the uncompiled .ts file.

Using Vite

value is undefined

Select<@http://localhost:4400/src/input/Select.tsx:136:15
...

Using Next JS

value is undefined

./libs/client/components/shared/src/input/Select.tsx/Select<@http://localhost:4400/main.iframe.bundle.js:1081:5
...

To Reproduce

  1. Create a Storybook for a TypeScript component that throws an error using Next JS addon.
  2. Run the Storybook.

Repro: https://stackblitz.com/edit/github-nh9svy

System

Storybook Environment Info:

  System:
    OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 20.2.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn <----- active
    npm: 9.6.6 - /usr/local/bin/npm
    pnpm: 8.6.1 - /usr/local/share/npm-global/bin/pnpm
  npmPackages:
    @storybook/addon-docs: 7.6.1 => 7.6.1 
    @storybook/addon-essentials: 7.6.1 => 7.6.1 
    @storybook/addon-interactions: 7.6.1 => 7.6.1 
    @storybook/client-api: 7.0.10 => 7.0.10 
    @storybook/core-common: ^7.0.9 => 7.6.16 
    @storybook/core-server: 7.6.1 => 7.6.1 
    @storybook/jest: 0.2.3 => 0.2.3 
    @storybook/nextjs: 7.6.1 => 7.6.1 
    @storybook/react-vite: ^8.0.4 => 8.0.4 
    @storybook/test-runner: ^0.16.0 => 0.16.0 
    @storybook/testing-library: 0.2.2 => 0.2.2 
    @storybook/testing-react: ^2.0.0 => 2.0.1 
    chromatic: ^6.5.1 => 6.24.1 
    eslint-plugin-storybook: ^0.6.12 => 0.6.15 
    storybook: 7.0.10 => 7.0.10

Additional context

No response

@valentinpalkovic
Copy link
Contributor

Hi @anthonyma94

Can you provide a minimal reproduction via https://storybook.new or by providing us a minimal reproduction repo?

@anthonyma94
Copy link
Author

@valentinpalkovic I have added a repro using the given template. Note the template doesn't seem to run, when I use yarn storybook it's frozen with no output:

❯ yarn storybook
warning Ignoring 'yarnPath' from '.yarnrc' because it's currently not supported.
yarn run v1.22.19
$ storybook dev -p 6006
@storybook/cli v8.1.0-alpha.4

// stuck here

Regardless, I changed Button.tsx to just throws an error, you'll see that the Storybook error message uses main.js and the line number from it, instead of Button.tsx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants