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

Storybook fully recompiles on file change #149

Open
kirillbashtenko opened this issue Oct 18, 2024 · 0 comments
Open

Storybook fully recompiles on file change #149

kirillbashtenko opened this issue Oct 18, 2024 · 0 comments

Comments

@kirillbashtenko
Copy link

Hi, not sure if it's exactly rsbuild issue, but for me when I save one file it recompiles all of them, considering 55 packages it's quite some time. I tried the Vite plugin for the storybook, and it only updates the affected file.

// main.ts
import { dirname, join } from "path";
const path = require("path");

module.exports = {
  transform: {
    "^.+\\.(t|j)sx?$": "@swc/jest",
  },
  stories: ["../packages/**/*.stories.@(js|jsx|ts|tsx)"],
  addons: [
   "@storybook/addon-actions",
    "@storybook/addon-a11y",
    "@storybook/addon-controls",
    "@storybook/addon-toolbars",
  ],
  framework:"storybook-react-rsbuild",
  rsbuildFinal: (config) => {
    config.output ??= {};
    config.output.assetPrefix = "/myproject/";
    return config;
  },
  typescript: {
    reactDocgen: false,
  },
};
// rsbuild.config.ts
import { defineConfig } from "@rsbuild/core";
import { pluginReact } from "@rsbuild/plugin-react";
import { pluginSvgr } from "@rsbuild/plugin-svgr";

export default defineConfig({
  plugins: [
    pluginReact(),
    pluginSvgr({
      svgrOptions: {
        exportType: "default",
        svgoConfig: {
          plugins: [
            {
              name: "preset-default",
              params: {
                overrides: {
                  removeViewBox: false,
                  inlineStyles: {
                    onlyMatchedOnce: false,
                  },
                  cleanupIds: false,
                },
              },
            },
          ],
        },
      },
    }),
  ],
});

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant