storybook: Storybook doesn't update my SVG files

Describe the bug

Once I start my Storybook with a story that has an SVG file in it, when I update that file, Storybook doesn’t show the updated version, even when I kill the process and start Storybook once again.

It seems that this bug is connected with cache because when I change the name of the file it works then just fine. I also tried to run start-storybook --no-manager-cache but it didn’t help.

To Reproduce

  1. Create a React component that imports an SVG file. I use babel-plugin-inline-react-svg to enable that
  2. Create a story of that component
  3. Start storybook
  4. Provide some changes to the SVG file
  5. Storybook doesn’t show that changes even when you restart it

Expected behavior

Storybook reloads itself and shows the updated version of the SVG file

Code snippets

Test.jsx

import React from "react";
import TestSVG from "./test.svg";

function Test() {
  return <TestSVG />;
}

export default Test;

Test.story.jsx

import React from "react";
import Test from "./Test";

export default {
  title: "Test",
  component: Test,
};

export const Default = args => <Test {...args} />;

System

Environment Info:
  System:
    OS: macOS 11.0.1
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
  Binaries:
    Node: 14.7.0 - ~/.nvm/versions/node/v14.7.0/bin/node
    Yarn: 1.22.4 - ~/.nvm/versions/node/v14.7.0/bin/yarn
    npm: 6.14.7 - ~/.nvm/versions/node/v14.7.0/bin/npm
  Browsers:
    Chrome: 87.0.4280.67
    Firefox: 82.0.2
    Safari: 14.0.1
  npmPackages:
    @storybook/addon-a11y: ^6.1.9 => 6.1.9 
    @storybook/addon-essentials: ^6.1.9 => 6.1.9 
    @storybook/react: ^6.1.9 => 6.1.9 

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 10
  • Comments: 15 (1 by maintainers)

Most upvoted comments

Решил эту проблему каждый раз удаляя кэш из node_modules

package.json

"storybook": "rm -rf node_modules/.cache/storybook && start-storybook -p 6006"

Just to keep the thread alive, still an issue.

Deleting ./node_modules/.cache/storybook/public gets around the issue.

same problem with v6.3.7