question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SCSS not being compiled 5.3.3

See original GitHub issue

Describe the bug I include scss files in preview.js file but it throws an error when running storybook yarn. The error states: ModuleParseError: Module parse failed: Unexpected character '@' (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

I am using "@storybook/preset-scss": "^1.0.2", & "@storybook/preset-create-react-app": "^1.5.1", - which during the project load a warning message states they may not be compatible with each other.

To Reproduce

  1. create a preview.js file and import scss - import '../src/all.scss'
  2. create a main.js file and add the presets and addons:
module.exports = {
  stories: ['../src/**/*.stories.js'],
  addons: [
    '@storybook/preset-scss',
    '@storybook/preset-create-react-app',
    '@storybook/addon-actions',
    '@storybook/addon-links',
    '@storybook/addons',
    '@storybook/addon-a11y',
    '@storybook/addon-docs/register', // still need to add /register with sb updgrade 5.3.3
    // '@storybook/addon-knobs',
    '@storybook/addon-knobs/register', // still need to add /register with sb updgrade 5.3.3
    '@storybook/addon-viewport',
    '@whitespace/storybook-addon-html/register',
  ],
};
  1. run yarn storybook

Expected behavior SCSS to compile and run in browser as CSS.

System: System: OS: macOS Sierra 10.12.6 CPU: (4) x64 Intel® Core™ i5-7360U CPU @ 2.30GHz Binaries: Node: 12.11.1 - ~/.nvm/versions/node/v12.11.1/bin/node Yarn: 1.13.0 - /usr/local/bin/yarn npm: 6.11.3 - ~/.nvm/versions/node/v12.11.1/bin/npm Browsers: Chrome: 79.0.3945.117 Firefox: 60.7.2 Safari: 12.1.1 npmPackages: @storybook/addon-a11y: ^5.3.3 => 5.3.3 @storybook/addon-actions: ^5.3.3 => 5.3.3 @storybook/addon-docs: ^5.3.3 => 5.3.3 @storybook/addon-info: ^5.3.3 => 5.3.3 @storybook/addon-knobs: ^5.3.3 => 5.3.3 @storybook/addon-links: ^5.3.3 => 5.3.3 @storybook/addon-viewport: ^5.3.3 => 5.3.3 @storybook/addons: ^5.3.3 => 5.3.3 @storybook/preset-create-react-app: ^1.5.1 => 1.5.1 @storybook/preset-scss: ^1.0.2 => 1.0.2 @storybook/react: ^5.3.3 => 5.3.3

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JonnyPScommented, Jan 17, 2020

@mrmckeb @shilman Thank you for your efforts. i have got everything running on 5.3.4 and it all seems to be working - addons, compiling scss, all stories showing… thanks

1reaction
mrmckebcommented, Jan 17, 2020

@JonnyPS I thought I had created a fix for this (I did clean the preset up in the process), but it turns out that this was caused by an import of preview.js into manager.js.

I also cleaned up the addons list:

  addons: [
    "@storybook/preset-create-react-app",
    "@storybook/addon-actions",
    "@storybook/addon-links",
    "@storybook/addon-a11y",
    "@storybook/addon-docs",
    "@storybook/addon-knobs",
    "@storybook/addon-viewport",
    "@whitespace/storybook-addon-html/register"
  ]

And finally I found an issue where all.scss was importing a file that doesn’t exist (from components).

And everything now works as expected.

Let me know how you go with the above 😃

CC @shilman

Read more comments on GitHub >

github_iconTop Results From Across the Web

SCSS file not compiling anymore - Stack Overflow
SCSS file not compiling anymore · Uninstalling current version of Sass and installing an older version · Installing the latest version of Sass...
Read more >
VSCode Extension - Live Sass Compiler - GitHub Pages
Compile Sass or Scss to CSS at realtime! ... Fixes bug where file names with two dots were not being matched consistently with...
Read more >
Sass, SCSS, and Less | PyCharm Documentation - JetBrains
To compile your code automatically, you need to configure a Sass, Less, or SCSS File Watcher which will track changes to your files...
Read more >
PHP - Wikipedia
PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 ...
Read more >
Dart Sass Command-Line Interface
By default, error CSS is enabled if you're compiling to at least one file on disk (as opposed to standard output). You can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found