storybookjs / builder-vite

A builder plugin to run and build Storybooks with Vite
MIT License
891 stars 107 forks source link

[Bug] import of package.json files are not hot reloaded #574

Closed willwill96 closed 1 year ago

willwill96 commented 1 year ago

What version of vite are you using?

4.2.1

System info and storybook versions

System: Windows Binaries: npm: 8.19.3 node: 16.19.1 npmPackages:

    "@storybook/addon-actions": "^7.0.5",
    "@storybook/addon-docs": "^7.0.5",
    "@storybook/addon-essentials": "^7.0.5",
    "@storybook/addon-links": "^7.0.5",
    "@storybook/api": "^7.0.5",
    "@storybook/react": "^7.0.5",
    "@storybook/react-vite": "^7.0.5",

Describe the Bug

I have a story that looks something like this:


import pkgJson from '../package.json'
export const MyStory = () => {
  return <div>
    <h1>Dependencies</h1>
    <ul>
        {JSON.stringify(pkgJson.dependencies)}
    </ul>
  </div>
}

The initial value loads fine, but it does not hot reload on changes to the package.json. This seems to work fine with other json files and only affects package.json files. I've also tried importing using raw: import pkgJson from '../package.json?raw', but I get the same result

Link to Minimal Reproducible Example

No response

Participation

willwill96 commented 1 year ago

Closing in favor of: https://github.com/storybookjs/storybook/issues/22114