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

I'm getting "Cannot find module" error #48

Open
RezDev94 opened this issue Aug 22, 2023 · 2 comments
Open

I'm getting "Cannot find module" error #48

RezDev94 opened this issue Aug 22, 2023 · 2 comments

Comments

@RezDev94
Copy link

RezDev94 commented Aug 22, 2023

Hi,

I get this error
Cannot find module '!!style-loader?injectType=lazyStyleTag!css-loader!sass-loader!../../scss-variables/light.scss' or its corresponding type declarations.

@boligolov
Copy link

Have the same issue

Internal server error: Failed to resolve import "!!style-loader?injectType=lazyStyleTag!css-loader!sass-loader!../src/assets/scss/light.scss" from ".storybook/preview.ts". Does the file exist?

But file exists.

Configuration:
vue: 3.3.11,
vite: 5.0.10
css-loader: 6.8.1
sass: 1.69.5
sass-loader: 13.3.2
storybook: 7.6.6
style-loader: 3.3.3

@marlyse-comte
Copy link

I had the same issue in Storybook 8.3
After doing the following, the issue was resoved:

  1. create styles.d.ts in path/to/src (for me /src/ is a sibling to .storybook
  2. in that file add the following:
    declare module "*.scss" { const content: Record<string, string>; }
    NOTE: after doing this, I also had to declare module .mdx

Now, add the following under compilerOptions to your tsconfig.ts file which sits in the .storybook directory:
"types": ["../src/styles.d.ts"]

Final note: Storybook 8 no longer needs sass-loader, style-loader, css-loader etc. (I'm using Angular, so your milleage might vary, but I can now import into preview.ts without any issues something like this:
import someTheme from '../src/path/to/file/my-styles.scss;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants