storybookjs / builder-vite

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

[Bug] Vite Failed to Resolve Import during Runtime #586

Open TomppaPackage opened 9 months ago

TomppaPackage commented 9 months ago

What version of vite are you using?

4.4.9

System info and storybook versions

System: OS: Windows 10 10.0.22621 CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P Binaries: Node: 18.17.1 - C:\Program Files\nodejs\node.EXE npm: 9.6.7 - C:\Program Files\nodejs\npm.CMD <----- active Browsers: Edge: Spartan (44.22621.2283.0), Chromium (117.0.2045.47)

Describe the Bug

When running Storybook via storybook dev, the application compiles and is hosted as expected.

However, when opening the browser, the Application crashes with the following error;

[vite] Internal server error: Failed to resolve import "D:WorkProjectsStorybook" from "..\..'..\virtual:\@storybook\builder-vite\vite./app.js"

The correct path should be `D:\Work Projects\StoryBook', though it appears to not parse the path correctly on Windows.

This works on an M1/M2 Mac.

Dependencies;

    "@storybook/addon-actions": "^7.3.2",
    "@storybook/addon-essentials": "^7.3.2",
    "@storybook/addon-interactions": "^7.3.2",
    "@storybook/addon-links": "^7.3.2",
    "@storybook/addon-mdx-gfm": "^7.3.2",
    "@storybook/react": "^7.3.2",
    "@storybook/react-vite": "^7.3.2",
    "@storybook/testing-library": "0.2.0",
    "@vitejs/plugin-react-swc": "^3.3.2",
    "storybook": "^7.3.2",
    "vite": "^4.4.9",
    "vite-plugin-dts": "^2.3.0"

Link to Minimal Reproducible Example

No response

Participation

IanVS commented 9 months ago

Hm, I haven't heard of windows problems for a while. Would you mind updating to the latest versions, and potentially clear and regenerate your lock file in case you have an old version of a storybook package hanging around?

TomppaPackage commented 9 months ago

@IanVS Same error I'm afraid, after running npx storybook@latest upgrade with a deleted lockfile. With a clean NPM cache for good measure.