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

Vue : fails to start with SCSS preset #14011

Closed
tholander opened this issue Feb 22, 2021 · 6 comments
Closed

Vue : fails to start with SCSS preset #14011

tholander opened this issue Feb 22, 2021 · 6 comments

Comments

@tholander
Copy link

Describe the bug
When trying to use SCSS preset on a brand new Vue 2 project, I'm not able to start Storybook. It fails with the message

Cannot find module 'vue-loader/lib/plugin'

To Reproduce
Steps to reproduce the behavior:

  1. Create a simple new Vue project with vue create <project-name>
  2. Select the default preset
  3. Initialize Storybook with npx sb init
  4. Install SCSS preset yarn add -D @storybook/preset-scss css-loader sass sass-loader style-loader
  5. Run yarn storybook or npm run storybook
  6. You should see error logs about framework-preset-vue not finding vue-loader/lib/plugins

Expected behavior
Storybook runs without errors/warnings

Screenshots
If applicable, add screenshots to help explain your problem.
Error logs

System
System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i5-8365U CPU @ 1.60GHz
Binaries:
Node: 14.15.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 88.0.4324.190
Edge: Spartan (44.18362.449.0)
npmPackages:
@storybook/addon-actions: ^6.1.18 => 6.1.18
@storybook/addon-essentials: ^6.1.18 => 6.1.18
@storybook/addon-links: ^6.1.18 => 6.1.18
@storybook/preset-scss: ^1.0.3 => 1.0.3
@storybook/vue: ^6.1.18 => 6.1.18

@phated
Copy link
Contributor

phated commented Feb 22, 2021

It doesn't seem like you installed the vue-loader peerDependency that @storybook/vue requires. This isn't installed for you automatically because some versions of vue-cli don't use webpack.

We may be able to add that dependency into your devDeps automatically on sb init with some of the features we built into the CLI to support Vue 3

@tholander
Copy link
Author

Indeed it resolved this problem, but now whenever I try to use SCSS in a SFC, I get this
image

I just add a style tag in the default Button component added by sb init with lang attribute set to scss

@tholander
Copy link
Author

The version of vue-loader I installed is 15.9.6

@tholander
Copy link
Author

OK I found what's wrong. It seems to be more a compatibility issue between sass-loader v11 and vue v2. Starting from v11, sass-loader requires webpack v5 and vue-cli works with webpack v4

@phated
Copy link
Contributor

phated commented Feb 24, 2021

Glad you figured it out! If you want to send a PR to the preset-scss README mentioning the version differences, I'll get that reviewed. Cheers!

@phated phated closed this as completed Feb 24, 2021
@shilman
Copy link
Member

shilman commented Feb 25, 2021

Egads!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.0-beta.3 containing PR #14018 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

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

No branches or pull requests

3 participants