my styles are not loading when I use the following syntax
import '../styles/some-component.scss';
but they will load when I use modules like so (which makes sense that they should since I have the css-loader
modules
option set to true
):
import '../styles/some-component.scss';
const className = styles.panel;
// etc...
to expand on the above, I'm loading the styles into React components like so:
import React from 'react';
import '../styles/loading-overlay.scss';
const LoadingOverlay = ({ loadingMessage}) => {
return (<div className="loading-effect-overlay">
<Blah loadingMessage={loadingMessage} />
</div>
);
};
export default LoadingOverlay;
I know I could easily inline the styles via import '!style-loader!css-loader!sass-loader!../styles/loading-overlay.scss';
, but I want them exported to the separate components css file.
I am using Webpack 2.2.1 and extract-text-webpack-plugin 2.0.0-rc.3
Here are the relevant (AFAIK) parts of the Webpack config:
const extractScss = new ExtractTextPlugin({
filename: '../css/components.css',
allChunks: true,
disable: enableDevServer
});
// etc...
config.module.rules.unshift({
test: /\.scss$/,
loader: extractScss.extract({
fallback: 'style-loader',
use: isProd ?
[
{
loader: 'css-loader',
options: {
localIdentName: '[name]-[local]-[hash:base64:5]',
modules: true,
// TODO: should we be using the minimize option here?
// minimize: true,
importLoaders: 1
}
},
'postcss-loader',
'sass-loader'
] :
[
{
loader: 'css-loader',
options: {
localIdentName: '[name]-[local]-[hash:base64:5]',
modules: true,
sourceMap: true,
importLoaders: 1
}
},
'postcss-loader',
'sass-loader?sourceMap'
]
})
});
any ideas why this might not be working? any additional info I need to provide?