presets: SCSS preset is not working with latest node-sass
Describe the bug
- I followed this guide to configure SCSS in my storybook project: https://github.com/storybookjs/presets/tree/master/packages/preset-scss#basic-usage
- when executing the project I would get this error coming from the “sass-loader” package
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
TypeError: this.getOptions is not a function
at Object.loader
- I found out this issue almost identical on “nuxt”
- the solution proposed was to install a supported version of “sass-loader@10.1.1” not the 11 version.
Possible Fix would be identical to this
npm uninstall -D sass-loader && npm install -D sass-loader@10.1.1
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 24
- Comments: 24 (1 by maintainers)
Commits related to this issue
- resolve scss import issue. Please refer to: https://github.com/storybookjs/presets/issues/195 — committed to solring/mock-dashboard by solring 3 years ago
Not sure if this will help someone but I had to do a third downgrade before things worked. Here are my steps:
This is the solution. Absolutely terrible add-on if the basic readme.md doesn’t even work.
Here’s my full config seen as this is what infuriated me when people post their ‘solutions’.
main.js
package.json
If you have the same packages as above it will finally work.
Complete waste of many hours due to this stupid plugin.
@PudparK I have same problem, you also need fixed
style-loaderversion to2.0.0, that’s work for me.Do we know if storybook has a plan to update to webpack 5?
PR created to update preset-scss README
https://github.com/storybookjs/presets/pull/209
In case someone initialised storybook to the existing create-react-app project, do the above (downgrade sass-loader to 10.1.1) and remove
@storybook/preset-create-react-appfrom the.storybook/main.jsfile.Thanks @riccardogiorato & @massivelines
If you have sass-loader installed try changing the installed version to 10.1.1, that fixed it for me. v11 went out on Feb 5th and now requires webpack 5.
Think this also might fix the issue for 191
This works for me, thanks. It has been almost a year now since this issue is reported and sadly the issue still occurs. I hope this gets fixed soon.
Tnx dude
The following packages still aren’t working with this SCSS preset. After trying the command from lawnchamp.
I’m attempting to use builder 5 so, maybe that’s what’s causing issues? Repo here
package.jsonmain.jsif you get this error
you should use this: