Skip to content

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

Closed as not planned
Closed as not planned
@IanVS

Description

@IanVS

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions