builder-vite icon indicating copy to clipboard operation
builder-vite copied to clipboard

[Bug] Unable to compile TypeScript

Open IleniaTedde opened this issue 2 years ago • 2 comments

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

  • [ ] I am willing to submit a pull request for this issue.

IleniaTedde avatar Feb 10 '23 17:02 IleniaTedde

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

b3nab avatar Feb 13 '23 17:02 b3nab

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

What are your module and moduleResolution set to?

IanVS avatar Feb 16 '23 13:02 IanVS