histoire icon indicating copy to clipboard operation
histoire copied to clipboard

Collecting Stories throws Error in Nuxt3 project "Failed to parse source for import analysis because the content contains invalid JS syntax."

Open kaesetoast opened this issue 1 year ago • 1 comments

Describe the bug

I recently started to play around with Nuxt3 and wanted to add histoire. When I execute yarn stoty:dev, I get the following error:

17:40:57 [vite] warning: LintOnStart is turned on, and it will check for all matching files.
  Plugin: vite-plugin-eslint (x3)
Failed to resolve dependency: vscode-oniguruma, present in 'optimizeDeps.include'
Failed to resolve dependency: vscode-textmate, present in 'optimizeDeps.include'
Using 8 threads for story collection
Collect stories start all
  ➜  Local:   http://127.0.0.1:6006/
  ➜  Network: use --host to expose
Error while collecting story /home/philipp/Projects/nuxt-starter/components/primitives/un-button.story.vue:
Error: Failed to parse source for import analysis because the content contains invalid JS syntax. Install @vitejs/plugin-vue to handle .vue files.
    at formatError (file:///home/philipp/Projects/nuxt-starter/node_modules/vite/dist/node/chunks/dep-79892de8.js:43113:46)
    at TransformContext.error (file:///home/philipp/Projects/nuxt-starter/node_modules/vite/dist/node/chunks/dep-79892de8.js:43109:19)
    at TransformContext.transform (file:///home/philipp/Projects/nuxt-starter/node_modules/vite/dist/node/chunks/dep-79892de8.js:41313:22)
    at async Object.transform (file:///home/philipp/Projects/nuxt-starter/node_modules/vite/dist/node/chunks/dep-79892de8.js:43387:30)
    at async loadAndTransform (file:///home/philipp/Projects/nuxt-starter/node_modules/vite/dist/node/chunks/dep-79892de8.js:41105:29)
Collect stories end 641ms

I basically follwed the documentation to set this up, everything should be pretty bare-bone. I tried installing @vitejs/plugin-vue, but I don't think this was the real issue. It also didn't change anything.

My apologies if this is a duplicate – I searched the issues intensively, but couldn't find an issue that seemed exactly related.

Reproduction

https://gitlab.pno.dev/pno/nuxt-starter

System Info

System:
    OS: Linux 6.1 Fedora Linux 37 (Workstation Edition)
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1270P
    Memory: 20.01 GB / 31.05 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.18.0/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
  Browsers:
    Brave Browser: 111.1.49.120
    Chrome: 111.0.5563.64
    Firefox: 110.0
  npmPackages:
    @histoire/plugin-nuxt: ^0.15.9 => 0.15.9 
    @histoire/plugin-vue: ^0.15.8 => 0.15.8 
    @vitejs/plugin-vue: ^4.1.0 => 4.1.0 
    histoire: ^0.15.9 => 0.15.9

Used Package Manager

yarn

Validations

kaesetoast avatar Apr 03 '23 10:04 kaesetoast