storybookjs / builder-vite

A builder plugin to run and build Storybooks with Vite
MIT License
891 stars 107 forks source link

[Bug] Unable to compile TypeScript #559

Open IleniaTedde opened 1 year ago

IleniaTedde commented 1 year ago

What version of vite are you using?

3.2.5

System info and storybook versions

System: OS: macOS 12.2 CPU: (8) arm64 Apple M1 Binaries: Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v16.13.0/bin/yarn npm: 9.4.2 - ~/.nvm/versions/node/v16.13.0/bin/npm Browsers: Chrome: 109.0.5414.119 Firefox: 109.0 Safari: 15.3 npmPackages: @storybook/addon-essentials: ^6.5.15 => 6.5.16 @storybook/builder-vite: ^0.2.6 => 0.2.7 @storybook/core-common: ^6.5.16 => 6.5.16 @storybook/core-server: ^6.5.15 => 6.5.16 @storybook/html: ^6.5.15 => 6.5.16 @storybook/web-components: ^6.5.15 => 6.5.16

Describe the Bug

Hello, i'm using nx to manage a monorepo and when i run storybook it give me the following errors:

nx run vehicle-header:storybook

info @storybook/web-components v6.5.16 info ERR! TSError: ⨯ Unable to compile TypeScript: ERR! packages/vehicle-header/.storybook/main.ts:2:47 - error TS2792: Cannot find module '@storybook/core-common'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? ERR! ERR! 2 import type { StorybookConfig, Options } from '@storybook/core-common'; ERR! ~~~~~~~~ ERR! packages/vehicle-header/.storybook/main.ts:6:29 - error TS2792: Cannot find module 'vite'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? ERR! ERR! 6 import { mergeConfig } from 'vite' ERR! ~~ ERR! packages/vehicle-header/.storybook/main.ts:7:31 - error TS2792: Cannot find module 'vite-tsconfig-paths'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? ERR! ERR! 7 import viteTsConfigPaths from 'vite-tsconfig-paths'

Do you know how can i resolve this issue?

Link to Minimal Reproducible Example

No response

Participation

b3nab commented 1 year ago

This issue seems similar to #298 but no one yet have a solution. Someone know a workaround for this error?

IanVS commented 1 year ago

Did you mean to set the 'moduleResolution' option to 'node'

What are your module and moduleResolution set to?