Skip to content

fix: resolve pnpm hoisting issue with StorybookConfig type imports #923

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

Merged
merged 4 commits into from
Jul 16, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 11, 2025

Problem

When using pnpm without hoisting (e.g., without shamefully-hoist=true), users cannot import types from @storybook-vue/nuxt directly because the package is not available at the top-level node_modules. This causes TypeScript compilation errors when trying to use:

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

Solution

This PR fixes the issue by ensuring that all types from @storybook-vue/nuxt are properly re-exported through @nuxtjs/storybook, allowing users to import types directly from the main package:

import type { StorybookConfig } from '@nuxtjs/storybook'

Changes Made

  1. Fixed package.json exports: Updated packages/nuxt-module/package.json to point to the correct .d.mts TypeScript declaration files instead of non-existent .d.ts files.

  2. Updated examples: Changed import statements in playground and examples to use @nuxtjs/storybook instead of @storybook-vue/nuxt.

  3. Updated documentation: Modified the configuration documentation to show the correct import pattern.

Technical Details

The fix leverages the existing export * from '@storybook-vue/nuxt' in the nuxt-module source code, which already re-exports all types including StorybookConfig. The main issue was that the package.json exports weren't pointing to the correct TypeScript declaration files, preventing proper type resolution.

Now users can safely import types using either pattern, but the recommended approach is to import from @nuxtjs/storybook to avoid pnpm hoisting issues.

This solution works in both hoisted and non-hoisted pnpm environments without requiring users to configure shamefully-hoist=true.

Fixes #920.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.iconify.design
    • Triggering command: node (vitest 1) (dns block)
  • fonts.bunny.net
    • Triggering command: node (vitest 1) (dns block)
  • storybook.js.org
    • Triggering command: node /home/REDACTED/work/storybook/storybook/playground/node_modules/.bin/../storybook/bin/index.cjs build (dns block)
    • Triggering command: node /home/REDACTED/work/storybook/storybook/examples/starter/node_modules/.bin/../storybook/bin/index.cjs build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link

netlify bot commented Jul 11, 2025

Deploy Preview for nuxt-storybook failed. Why did it fail? →

Name Link
🔨 Latest commit 39edfe1
🔍 Latest deploy log https://app.netlify.com/projects/nuxt-storybook/deploys/6877b67f0615620007bb491a

Co-authored-by: tobiasdiez <5037600+tobiasdiez@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] pnpm can't resolve @storybook-vue/nuxt when deps not hoisted Fix pnpm hoisting issue with StorybookConfig type imports Jul 11, 2025
@Copilot Copilot AI requested a review from tobiasdiez July 11, 2025 21:30
Copilot finished work on behalf of tobiasdiez July 11, 2025 21:30
@tobiasdiez tobiasdiez changed the title Fix pnpm hoisting issue with StorybookConfig type imports fix: resolve pnpm hoisting issue with StorybookConfig type imports Jul 16, 2025
@tobiasdiez tobiasdiez marked this pull request as ready for review July 16, 2025 14:26
@tobiasdiez tobiasdiez merged commit 6c85b76 into main Jul 16, 2025
27 of 31 checks passed
@tobiasdiez tobiasdiez deleted the copilot/fix-920 branch July 16, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pnpm can't resolve @storybook-vue/nuxt when deps not hoisted
2 participants