Giter VIP home page Giter VIP logo

vue-vite-storybook-mini-repo's Introduction

vue-storybook-repo

This is a repo for the reproduction of a vite bug that occurs with the latest Storybookjs package (as of right now, 7.0.0-alpha.38). Vite has also been updated to version 3.2.0-beta.2, to make sure all recent bug fixes are included. Because storybook sets its own vite dependency, i have used yarn's "resolutions" option to set the next vite to override any sub vite dependencies.

the problem

When trying to run yarn storybook, storybook does start the server and at least runs the main skeleton of the app, but no stories or pages are loaded. In the terminal the following error and output is given:

yarn storybook
yarn run v1.22.19
warning package.json: No license field
$ storybook dev -p 6006
@storybook/cli v7.0.0-alpha.38

info => Loading presets
info => Loading presets
info => Loading presets
info => Starting manager..
(node:26224) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
╭─────────────────────────────────────────────────────╮
│                                                     │
│   Storybook 7.0.0-alpha.38 for vue3-vite started    │
│   3.27 s for manager and 4.94 s for preview         │
│                                                     │
│    Local:            http://localhost:6006/         │
│    On your network:  http://10.253.254.250:6006/    │
│                                                     │
╰─────────────────────────────────────────────────────╯
3:52:12 PM [vite] error while updating dependencies:
Error: ENOENT: no such file or directory, rename 'C:\vueStorybook\vue-storybook-repo\node_modules\.cache\.vite-storybook\deps_temp' -> 'C:\vueStorybook\vue-storybook-repo\node_modules\.cache\.vite-storybook\deps'

in the browser i also get the following errors in the console:

Failed to load resource: the server responded with a status of 404 (Not Found)
:6006/sb-addons%5Caddon-controls%5Cmanager.mjs:1          Failed to load resource: the server responded with a status of 404 (Not Found)
:6006/sb-addons%5Caddon-actions%5Cmanager.mjs:1          Failed to load resource: the server responded with a status of 404 (Not Found)
:6006/sb-addons%5Caddon-backgrounds%5Cmanager.mjs:1          Failed to load resource: the server responded with a status of 404 (Not Found)
:6006/sb-addons%5Caddon-viewport%5Cmanager.mjs:1          Failed to load resource: the server responded with a status of 404 (Not Found)
:6006/sb-addons%5Caddon-toolbars%5Cmanager.mjs:1          Failed to load resource: the server responded with a status of 404 (Not Found)
:6006/sb-addons%5Caddon-measure%5Cmanager.mjs:1          Failed to load resource: the server responded with a status of 404 (Not Found)
:6006/sb-addons%5Caddon-outline%5Cmanager.mjs:1          Failed to load resource: the server responded with a status of 404 (Not Found)
:6006/sb-addons%5Caddon-interactions%5Cmanager.mjs:1          Failed to load resource: the server responded with a status of 404 (Not Found)
client.ts:19 [vite] connecting...
client.ts:134 [vite] connected.
:6006/node_modules/.cache/.vite-storybook/deps/@storybook_vue3-vite.js?v=907fe626:1          Failed to load resource: the server responded with a status of 504 (Gateway Timeout)

How to reproduce

If the error doesnt show up right away, delete the .cache folder from node_modules and run yarn storybook again. The error should now be consistent.

Somewhat of a workaround

I dont know if this is an actual workaround because it still doesnt quite work, but this procedure will at least allow storybook to successfully load stories and pages. We can now see the components, however i cant do much (likely due to the files that wont load):

Workaround procedure

  1. Find the file node_modules/vite/dist/node/chunks/dep-0856a44a.js

  2. Go to line 42613 that has the follow snippet:

     42605: const processingResult = {
     42606:  metadata,
     42607:  async commit() {
     42608:    // Write metadata file, delete `deps` folder and rename the 42609: `processing` folder to `deps`
     42610:    // Processing is done, we can now replace the depsCacheDir with 42611: processingCacheDir
     42612:    // Rewire the file paths from the temporal processing dir to the 4261: final deps cache dir
     42613:    await removeDir(depsCacheDir);
     42614:    await renameDir(processingCacheDir, depsCacheDir);
     42615:  },
     42616:  cancel() {
     42617:    fs$l.rmSync(processingCacheDir, { recursive: true, force: true });
     42618:  },
     42619: };
    1. stop build process, if it's running.
    2. Comment out line 42613.
    3. Run yarn storybook again
    4. Storybook now loads the front page successfuly and you can click the pages and see the stories/components. Also the follow is output from the terminal, instead of error:
     PS C:\vueStorybook\vue-storybook-repo> yarn storybook
     yarn run v1.22.19
     warning package.json: No license field
     $ storybook dev -p 6006
     @storybook/cli v7.0.0-alpha.38
    
     info => Loading presets
     info => Loading presets
     info => Loading presets
     info => Starting manager..
     (node:28288) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
     (Use `node --trace-warnings ...` to show where the warning was created)
     ╭─────────────────────────────────────────────────────╮
     │                                                     │
     │   Storybook 7.0.0-alpha.38 for vue3-vite started    │
     │   2.81 s for manager and 3.5 s for preview          │
     │                                                     │
     │    Local:            http://localhost:6006/         │
     │    On your network:  http://10.253.254.250:6006/    │
     │                                                     │
     ╰─────────────────────────────────────────────────────╯
     4:14:02 PM [vite] ✨ new dependencies optimized: @storybook/vue3-vite, @storybook/vue3/preview, @storybook/addon-links/preview, @storybook/addon-docs/preview, @storybook/addon-actions/preview, ...and 5 more
     4:14:02 PM [vite] ✨ optimized dependencies changed. reloading
    

    System information

OS: Windows 11
node: v18.9.1
yarn: v1.22.19
PS C:\vueStorybook\vue-storybook-repo> yarn list vite
yarn list v1.22.19
└─ [email protected]
PS C:\vueStorybook\vue-storybook-repo> yarn list storybook
yarn list v1.22.19
└─ [email protected]
PS C:\vueStorybook\vue-storybook-repo> yarn list @storybook/*
yarn list v1.22.19
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
│  ├─ @storybook/[email protected]
│  ├─ @storybook/[email protected]
│  ├─ @storybook/[email protected]
│  ├─ @storybook/[email protected]
│  ├─ @storybook/[email protected]
│  ├─ @storybook/[email protected]
│  ├─ @storybook/[email protected]
│  ├─ @storybook/[email protected]
│  └─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
└─ @storybook/[email protected]

vue-vite-storybook-mini-repo's People

Contributors

nikki-cat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.