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

Styles not being loaded, followed instructions on docs #3177

Closed
christopher-francisco opened this issue Mar 9, 2018 · 7 comments
Closed

Comments

@christopher-francisco
Copy link

christopher-francisco commented Mar 9, 2018

Issue details

I'm using webpack 2.4.1. Followed the instructions in custom webpack config to load SCSS files.

Now, here's the thing. My app loads a single styles.scss files, which @imports from node_modules and relative partial scss files:

@import '~react-virtualized/styles.css';
@import './_tables';

The styles coming from react-virtualized work (I see a change when commenting on/off the import line). But the one from ./_tables don't. The styles are not in the page.

I even tested adding a non existing @import call inside _tables.scss, @import './non-existing' to see if it crashes, and it does crash, so at the very least the file is being read.

In the actual app, the loading is done in the src/index.js file.

// index.js
import React from 'react';
import { render } from 'react-dom';

import App from './App';
import './assets/styles.scss';
...
...
render(<App />, mount);

In the storybook, I don't really know where to load it, so I'm doing directly in the index.story.js file: import '../src/assets/styles.scss';.

As I said before, the .storybook/webpack.config.js is the same as the one on the docs page:

...
module: {
    rules: [
      {
        test: /\.scss$/,
        loaders: ["style-loader", "css-loader", "sass-loader"],
        include: path.resolve(__dirname, '../')
      },
...

Any idea on what could be missing?

Please specify which version of Storybook and optionally any affected addons that you're running

  • @storybook/react 3.3.15

Affected platforms

  • Chrome 65, MacOS High Sierra
@danielduan
Copy link
Member

I believe the node_modules are excluded from webpack by default. You will need to remove that entry in the excludes list.

@christopher-francisco
Copy link
Author

@danielduan I'm sorry I didn't follow, could you provide a code line to see what is it, please?

@danielduan
Copy link
Member

include: path.resolve(__dirname, '../')
should have node_modules in it

@christopher-francisco
Copy link
Author

include: ['node_modules', path.resolve(__dirname, '../')] you mean both paths? or only one

@danielduan
Copy link
Member

depends on where your .scss files are located. if they're in both, then you need both.

@stale
Copy link

stale bot commented Mar 30, 2018

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Mar 30, 2018
@stale
Copy link

stale bot commented Apr 29, 2018

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

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

2 participants