storybook: [Bug]: doesn't exist at build time, it will remain unchanged to be resolved at runtime

Describe the bug

Build output:

info => Cleaning outputDir: /build
info => Loading presets
info => Building manager..
info => Manager built (121 ms)
info => Copying static files: /Users/lvchenyang/Projects/cya/mintpie-gravitation/common/temp/node_modules/.pnpm/@storybook+manager@7.0.10/node_modules/@storybook/manager/static at /Users/lvchenyang/Projects/cya/mintpie-gravitation/docs/build/sb-common-assets
vite v4.3.5 building for production...

> ./sb-common-assets/fonts.css doesn't exist at build time, it will remain unchanged to be resolved at runtime

✓ 1501 modules transformed.
build/assets/direction-94a9917f.svg                         1.28 kB │ gzip:   0.71 kB
build/assets/flow-275142c6.svg                              1.39 kB │ gzip:   0.68 kB
build/assets/code-brackets-9ef6443e.svg                     1.46 kB │ gzip:   0.69 kB
build/assets/comments-f15a6837.svg                          1.53 kB │ gzip:   0.70 kB
build/assets/repo-fb4ece47.svg                              1.64 kB │ gzip:   0.83 kB
build/assets/plugin-57148314.svg                            2.17 kB │ gzip:   0.98 kB
build/assets/stackalt-2ad81543.svg                          2.55 kB │ gzip:   1.09 kB
build/assets/colors-ac9401f3.svg                            8.51 kB │ gzip:   3.61 kB
build/iframe.html                                          12.76 kB │ gzip:   3.59 kB
build/assets/AddressEditor.stories-43daeb51.css             0.06 kB │ gzip:   0.08 kB
build/assets/Header-a6911580.css                            0.51 kB │ gzip:   0.31 kB

How to ignore this build error?

When I run rush build in gitlab CI/CD pipeline, this output will cause the pipeline job fail!

image

To Reproduce

No response

System

Environment Info:

  System:
    OS: macOS 13.3.1
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 16.20.0 - ~/.nvm/versions/node/v16.20.0/bin/node
    Yarn: 3.2.0 - ~/.nvm/versions/node/v16.20.0/bin/yarn
    npm: 8.19.4 - ~/.nvm/versions/node/v16.20.0/bin/npm
  Browsers:
    Chrome: 113.0.5672.92
    Safari: 16.4
  npmPackages:
    @storybook/addon-essentials: ^7.0.10 => 7.0.10 
    @storybook/addon-interactions: ^7.0.10 => 7.0.10 
    @storybook/addon-links: ^7.0.10 => 7.0.10 
    @storybook/blocks: ^7.0.10 => 7.0.10 
    @storybook/builder-vite: ^7.0.10 => 7.0.10 
    @storybook/react: ^7.0.10 => 7.0.10 
    @storybook/react-vite: ^7.0.10 => 7.0.10 
    @storybook/testing-library: ^0.1.0 => 0.1.0

Additional context

main.ts

import type { StorybookConfig } from "@storybook/react-vite";
import { mergeConfig } from "vite";

const config: StorybookConfig = {
  stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
  ],
  core: {
    builder: "@storybook/builder-vite",
  },
  framework: {
    name: "@storybook/react-vite",
    options: {},
  },
  docs: {
    autodocs: "tag",
  },
  async viteFinal(config) {
    return mergeConfig(config, {
      build: {
        chunkSizeWarningLimit: 4096,
        rollupOptions: {
          onwarn: ({ message }) => {
            if (/Use of eval in/.test(message)) {
              return;
            }
            console.log(message);
          },
        },
      },
    });
  },
};
export default config;

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 20
  • Comments: 17 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Anybody figured out how to fix this?

I have the same error. It seems the problem is in the iframe.html file (from builder-vite package), in that package, there is no assets folder to get the fonts. Screenshot 2023-06-28 at 14 00 36

Still got this issue, any way to fix it?

did any one resolve the error !!

Also getting this error. The build seems to work though…

I am also getting this error when importing our stylesheet with a relative path in the preview.ts file

You might also get this issue if you are importing markdown files.

To fix the issue, you need to change the import:

-import changeLog from './changelog.md`
+import changeLog from './changelog.md?raw`