question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

404 - Storybook cannot find components

See original GitHub issue

Description Dev server works with the exact same config but Storybook seems to struggle.

Strange log as I don’t use JSX or TSX

Plugin: vite:import-analysis
16:13:41 [vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
  Plugin: vite:import-analysis

and the browser console logs 404

GET http://localhost:6006/src/stories/BasicHeader.vue?vue&type=div&index=0&lang.div net::ERR_ABORTED 404 (Not Found)

To Reproduce Please create a reproduction by running yarn && yarn storybook Repo can be found at https://github.com/Miguel-Bento-Github/vite-vue-ts-storybook

Environment Info:

  System:
    OS: macOS 12.0.1
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.9.1 - /usr/local/bin/node
    Yarn: 1.22.15 - /opt/homebrew/bin/yarn
    npm: 7.21.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 96.0.4664.55
    Firefox: 94.0.2
    Safari: 15.1
  npmPackages:
    @storybook/addon-a11y: ^6.4.3 => 6.4.3 
    @storybook/addon-actions: ^6.4.3 => 6.4.3 
    @storybook/addon-essentials: ^6.4.3 => 6.4.3 
    @storybook/addon-links: ^6.4.3 => 6.4.3 
    @storybook/vue3: ^6.4.3 => 6.4.3 

Help is appreciated in advance.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
IanVScommented, Dec 8, 2021

It does look like that’s what you’re hitting. I don’t think another issue would help, since there’s already a PR open. It’s probably best to give it a little time, or try to find a workaround to remove the types or ignore the errors for now until it is fixed.

1reaction
IanVScommented, Dec 1, 2021

It looks like your viteFinal is not quite right. You can remove the vue() plugin because the storybook builder already includes it and you’ll end up with a duplicate, and you need to specify options to the vueI18n plugin:

diff --git a/.storybook/main.js b/.storybook/main.js
index f388ad7..6a16dfb 100644
--- a/.storybook/main.js
+++ b/.storybook/main.js
@@ -33,7 +33,14 @@ module.exports = {

     return mergeConfig(previousConfig, {
       ...config,
-      plugins: [vue(), vueI18n(), eslintPlugin()],
+      plugins: [
+        vueI18n({
+          include: path.resolve(__dirname, "../src/locales/**"),
+          compositionOnly: false,
+          runtimeOnly: false,
+        }),
+        eslintPlugin()
+      ],
     });
   },
 };

When I make that change, storybook builds correctly. Let me know if you still have any issues though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storybook cannot find components 404 · Issue #16860 - GitHub
Describe the bug Dev server works with the exact same config but Storybook seems to struggle. Strange log as I don't use JSX...
Read more >
Storybook javascript GET 404 (Not Found) error about ...
I need to fix a Storybook with stories, it's broken (it's unclear when it was broken, probably after some angular upgrades a while...
Read more >
Storybook Composition
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >
Error Boundaries - React
These errors were always caused by an earlier error in the application code, but React did not provide a way to handle them...
Read more >
Using Storybook and Mock Service Worker for mocked API ...
While that is a valid part of the component's behavior, the HTTP request it makes doesn't belong in Storybook. Making actual requests in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found