Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The requested module '/node_modules/jsdoc-type-pratt-parser/dist/index.js?v=dd771ee8' does not provide an export named 'parse' #776

Open
tomrob270 opened this issue Sep 17, 2024 · 9 comments · Fixed by storybookjs/storybook#29179
Labels
status: needs reproduction Needs a minimal reproduction type: bug Something isn't working

Comments

@tomrob270
Copy link

tomrob270 commented Sep 17, 2024

Getting above error when adding storybook. It is correctly picking up .stories.ts files
image

.storybook/main

import type { StorybookConfig } from "@storybook-vue/nuxt";

const config: StorybookConfig = {
  stories: [
    "stories/**/*.mdx",
    "stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
    "../components/**/*.stories.@(js|jsx|mjs|ts|tsx)",
  ],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
  ],
  framework: {
    name: "@storybook-vue/nuxt",
    options: {},
  },
  docs: {
    autodocs: "tag",
  },
};
export default config;

nuxt config

  modules: [
    "nuxt-quasar-ui",
    "@vueuse/nuxt",
    "@pinia/nuxt",
    "@pinia-plugin-persistedstate/nuxt",
    "@formkit/auto-animate/nuxt",
    "@hebilicious/vue-query-nuxt",
    "@nuxt/eslint",
    "@nuxtjs/i18n",
    "nuxt-monaco-editor",
    "nuxt-lodash",
    "@nuxtjs/storybook",
  ],

package.json

  "devDependencies": {
    "@nuxt/devtools": "latest",
    "@nuxt/eslint": "^0.5.0",
    "@nuxt/test-utils": "^3.14.0",
    "@nuxtjs/i18n": "latest",
    "@nuxtjs/storybook": "^8.2.0",
    "@pinia-plugin-persistedstate/nuxt": "^1.2.1",
    "@storybook/addon-essentials": "^8.3.1",
    "@types/jsurl": "^0.1.2",
    "@types/lodash": "^4.17.7",
    "@types/md5": "^2.3.5",
    "@types/sanitize-html": "^2.11.0",
    "drizzle-kit": "latest",
    "eslint": "^9.8.0",
    "eslint-plugin-prettier": "^5.1.3",
    "nuxt": "^3.11.2",
    "nuxt-lodash": "latest",
    "nuxt-monaco-editor": "latest",
    "nuxt-quasar-ui": "^2.0.6",
    "pg": "^8.11.3",
    "prettier": "^3.3.2",
    "sass": "^1.69.5",
    "typescript": "^5.4.5",
    "vite-plugin-node-polyfills": "^0.22.0",
    "vitest": "^2.0.4",
    "vue": "^3.3.10",
    "vue-component-type-helpers": "^2.0.6",
    "vue-router": "^4.2.5"
  },
@tobiasdiez
Copy link
Collaborator

Could you please provide a minimal reproduction In particular, test if one of the plugins are creating the issue. As a workaround, you may try to add jsdoc-type-pratt-parser to optimizeDeps.include.

@tobiasdiez tobiasdiez added type: bug Something isn't working status: needs reproduction Needs a minimal reproduction labels Sep 17, 2024
@CraigThatcher
Copy link

This appears to be introduced with 8.3.x in @storybook/core. This is not shown in the online examples linked to StackBlitz from the website. Those examples are currently experiencing a 404 bug looking for /sb-preview/runtime.js.

The workaround provided above for optimizeDeps.include does fix the problem.

@cheindl
Copy link

cheindl commented Sep 18, 2024

I got the same error; but the workaround does not work for me. I put jsdoc-type-pratt-parser to optimizeDeps.include within .storybook/main.ts, but then it show the same error with vue itself:

The requested module '/node_modules/vue/dist/vue.runtime.esm-bundler.js?v=89f1e65f' does not provide an export named 'useId'

package.json:

"devDependencies": {
    "@graphql-codegen/cli": "^5.0.2",
    "@graphql-codegen/near-operation-file-preset": "^3.0.0",
    "@graphql-codegen/typed-document-node": "^5.0.6",
    "@graphql-codegen/typescript": "^4.0.6",
    "@graphql-codegen/typescript-operations": "^4.2.0",
    "@nuxt/eslint": "^0.5.0",
    "@nuxt/eslint-config": "^0.5.0",
    "@nuxt/icon": "^1.2.1",
    "@nuxt/test-utils": "^3.13.1",
    "@nuxtjs/i18n": "8.5.2",
    "@nuxtjs/storybook": "~8.2.0",
    "@pinia/nuxt": "^0.5.1",
    "@storybook-vue/nuxt": "~8.2.0",
    "@storybook/addon-a11y": "~8.3.0",
    "@storybook/addon-essentials": "~8.3.0",
    "@storybook/addon-interactions": "~8.3.0",
    "@storybook/addon-links": "~8.3.0",
    "@storybook/blocks": "~8.3.0",
    "@storybook/test": "~8.3.0",
    "@types/node": "^20.0.0",
    "@urql/vue": "^1.3.2",
    "@vue/test-utils": "^2.4.6",
    "@vuepic/vue-datepicker": "^9.0.0",
    "@vueuse/core": "^11.0.0",
    "@vueuse/nuxt": "^11.0.0",
    "@vueuse/router": "^11.0.0",
    "dayjs-nuxt": "^2.1.9",
    "eslint": "^9.0.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-prettier": "^5.2.1",
    "happy-dom": "14.12.3",
    "husky": "^9.1.4",
    "lint-staged": "^15.2.7",
    "nuxt": "3.13.1",
    "nuxt-swiper": "^1.2.2",
    "pinia": "^2.1.7",
    "playwright-core": "^1.45.0",
    "prettier": "^3.3.3",
    "sass": "^1.78.0",
    "storybook": "~8.3.0",
    "typescript": "^4.9.3",
    "venobox": "^2.1.8",
    "vitest": "^1.6.0"
  },

.storybook/main.ts

import type { StorybookConfig } from '@storybook-vue/nuxt';
import { mergeConfig } from 'vite';

const config: StorybookConfig = {
  core: {
    disableTelemetry: true,
  },
  stories: ['../components/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
  addons: [
    '@storybook/addon-links',
    '@storybook/addon-essentials',
    '@storybook/addon-interactions',
    '@storybook/addon-a11y',
  ],
  framework: {
    name: '@storybook-vue/nuxt',
    options: {},
  },
  staticDirs: [{ from: '../public/assets', to: 'assets' }],
  async viteFinal(config) {
     return mergeConfig(config, {
      optimizeDeps: {
        include: ['jsdoc-type-pratt-parser'],
      }
    });
  }
};
export default config;

@AtsMultanen
Copy link

Not sure if it'll make a difference @cheindl but try adding optimizeDeps.include: ['jsdoc-type-pratt-parser'] into nuxt.config.ts
https://nuxt.com/docs/api/nuxt-config#vite

@tomrob270
Copy link
Author

Could you please provide a minimal reproduction In particular, test if one of the plugins are creating the issue. As a workaround, you may try to add jsdoc-type-pratt-parser to optimizeDeps.include.

This fixes the error

@tobiasdiez
Copy link
Collaborator

Let's try to find a proper solution for this (which might be that we always add the optimizeDeps entry in the module).

First, it would be good to know with which storybook version this occurs first. Is it 8.3.0 or 8.3.1? In the latter case, this might be triggered by storybookjs/storybook#29134

@tobiasdiez tobiasdiez reopened this Sep 19, 2024
tobiasdiez added a commit that referenced this issue Sep 22, 2024
<!--
☝️ PR title should follow conventional commits
(https://conventionalcommits.org).
In particular, the title should start with one of the following types:

- docs: 📖 Documentation (updates to the documentation or readme)
- fix: 🐞 Bug fix (a non-breaking change that fixes an issue)
- feat: ✨ New feature/enhancement (a non-breaking change that adds
functionality or improves existing one)
- feat!/fix!: ⚠️ Breaking change (fix or feature that would cause
existing functionality to change)
- chore: 🧹 Chore (updates to the build process or auxiliary tools and
libraries)
-->

### 🔗 Linked issue

<!-- If it resolves an open issue, please link the issue here. For
example "Resolves #123" -->

### 📚 Description

Add browser-based tests to verify that Storybook starts in development
mode. Aim is to catch errors like
#776

<!-- Describe your changes in detail -->
<!-- Why is this change required? What problem does it solve? -->
@nathansmedley
Copy link

nathansmedley commented Sep 23, 2024

Let's try to find a proper solution for this (which might be that we always add the optimizeDeps entry in the module).

First, it would be good to know with which storybook version this occurs first. Is it 8.3.0 or 8.3.1? In the latter case, this might be triggered by storybookjs/storybook#29134

Also getting the same issue its a pretty new setup literally just been installing modules

Heres the current packag.json:

  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@nuxt/fonts": "^0.8.0",
    "@nuxt/image": "^1.8.0",
    "@nuxtjs/seo": "^2.0.0-rc.21",
    "@nuxtjs/storybook": "^8.2.0",
    "nuxt": "^3.13.2",
    "sass": "^1.79.3",
    "vue": "^3.5.8",
    "vue-router": "^4.4.5"
  }
}


@tobiasdiez
Copy link
Collaborator

tobiasdiez commented Sep 23, 2024

I could now reproduce it in the upgrade PR to v. 8.3.2 #779, but storybook v 8.3.0 works. So either add the optimizeDep for now (until its fixed upstream with storybookjs/storybook#29179) or force all storybook deps to be v8.3.0.

@fdendorfer
Copy link

fdendorfer commented Sep 27, 2024

Here's a repro with storybook@next, @storybook-vue/nuxt@nightly and @nuxtjs/storybook@nightly
https://stackblitz.com/edit/nuxt-starter-vwzpyp?file=README.md,package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs reproduction Needs a minimal reproduction type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants