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

The symbol "prevRefreshReg" has already been declared #19365

Closed
philipp-winterle opened this issue Oct 5, 2022 · 8 comments
Closed

The symbol "prevRefreshReg" has already been declared #19365

philipp-winterle opened this issue Oct 5, 2022 · 8 comments

Comments

@philipp-winterle
Copy link

Describe the bug
In the new 7.0 Alpha 35 it seems to break vite-plugin-react while launching storybook with storybook dev.

ERROR: The symbol "prevRefreshReg" has already been declared

Does not happen in Alpha 34.

System

Environment Info:

  System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.8.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 105.0.5195.125
    Firefox: 103.0.2
    Safari: 16.0
  npmPackages:
    @storybook/addon-essentials: 7.0.0-alpha.34 => 7.0.0-alpha.34
    @storybook/addon-links: 7.0.0-alpha.34 => 7.0.0-alpha.34
    @storybook/addons: ^7.0.0-alpha.34 => 7.0.0-alpha.34
    @storybook/cli: 7.0.0-alpha.34 => 7.0.0-alpha.34
    @storybook/react: 7.0.0-alpha.34 => 7.0.0-alpha.34
    @storybook/react-vite: ^7.0.0-alpha.34 => 7.0.0-alpha.34
    @storybook/theming: ^7.0.0-alpha.34 => 7.0.0-alpha.34
@philipp-winterle
Copy link
Author

Ok I figured out that this only happens after updating the react-vite package to alpha 35.

It is working with this setup

    "@storybook/addon-essentials": "7.0.0-alpha.35",
    "@storybook/addon-links": "7.0.0-alpha.35",
    "@storybook/addons": "7.0.0-alpha.35",
    "@storybook/cli": "7.0.0-alpha.35",
    "@storybook/react": "7.0.0-alpha.35",
    "@storybook/react-vite": "7.0.0-alpha.34",
    "@storybook/theming": "7.0.0-alpha.35",

and NOT working with this

    "@storybook/addon-essentials": "7.0.0-alpha.35",
    "@storybook/addon-links": "7.0.0-alpha.35",
    "@storybook/addons": "7.0.0-alpha.35",
    "@storybook/cli": "7.0.0-alpha.35",
    "@storybook/react": "7.0.0-alpha.35",
    "@storybook/react-vite": "7.0.0-alpha.35",
    "@storybook/theming": "7.0.0-alpha.35",

@ka2n
Copy link

ka2n commented Oct 14, 2022

Same here,

I see a log output below:

[@vitejs/plugin-react] You should stop using "vite:react-jsx" since this plugin conflicts with it.

UPDATE:

@hummal If you are doing mergeConfig with your local vite.config.js in .storybook/main.cjs#viteFinal, you may not need it.

@philipp-winterle
Copy link
Author

@ka2n thx for your input. It is true. Without plugin-react it is working. Also with alpha 38.

Thank you for your good input!

@kitsunekyo
Copy link

what exactly did you go with now? did you remove the @vitejs/plugin-react from the configuration of your storybook vite config? or did you remove something else?

@philipp-winterle
Copy link
Author

what exactly did you go with now? did you remove the @vitejs/plugin-react from the configuration of your storybook vite config? or did you remove something else?

As written in my answer above "without plugin-react it is working".

Just the plugin removed

@mandarini
Copy link
Contributor

Thank you for this, saved my life!!!! :D

@antoniormrzz
Copy link

for people using plugin-react-swc for vite, pass plugins: [] to mergeConfig of viteConfig. The mdx file isn't working but all the other stories look fine.

@FranciscoKloganB
Copy link

FranciscoKloganB commented Aug 2, 2023

@antoniormrzz if I pass plugins: [] to mergeConfig, I start getting another error:

Failed to load url /virtual:/@storybook/builder-vite/vite-app.js (resolved id: /virtual:/@storybook/builder-vite/vite-app.js). Does the file exist?

Any ideas?

edit: was probably doing a bad override using mergeConfig, I removed viteFinal, added this module https://storybook.js.org/docs/react/builders/vite, and everything works.

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

6 participants