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]: Vite runs define replacements in story-source #19830

Open
IanVS opened this issue Nov 14, 2022 · 2 comments
Open

[Bug]: Vite runs define replacements in story-source #19830

IanVS opened this issue Nov 14, 2022 · 2 comments

Comments

@IanVS
Copy link
Member

IanVS commented Nov 14, 2022

Describe the bug

Vite is performing define replacements on the code in story source, which is a problem for a few reasons:

  1. The code that appears there should appear largely as-written by the developer, so environment variables should remain intact (probably?).
  2. It replaces with double-quotes, which breaks syntax since the whole source string is inside double quotes.

To Reproduce

See https://github.com/storybookjs/storybook/pull/19805#discussion_r1021023879

System

No response

Additional context

I've fixed this in the past with storybookjs/builder-vite#364. I wonder if this has started to break now with the change to story-source from a webpack loader to an unplugin.

@shilman
Copy link
Member

shilman commented Jan 20, 2023

Note: we are moving back to source-loader for storysource, so your old fix should apply. Issue to track #20421

@mayank99
Copy link
Contributor

unsure if this is related, but i've noticed that after upgrading to 7.0 that story code doesn't load when using the vite builder.

see dedicated issue: #20475

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

3 participants