Error: Expected 'styles' to be an array of strings
You are only passing the css
files, and not the scss
files, to to-string-loader
, so require('./material2-app-theme.scss') is not returning a string
Change the scss
loader to...
{
test: /\.scss$/,
loaders: ['to-string-loader', 'css-loader', 'sass-loader'],
include: [helpers.root( 'src', 'styles' )]
}
Also make sure that ./material2-app-theme.scss
is in the include
folder
FYI You could easily combine these two loaders into one and simply use...
{
test: /\.(css|scss)$/,
loaders: ['to-string-loader', 'css-loader', 'sass-loader']
}
For completing the issue, if you use ExtractTextPlugin
, the "webpack.config.js" is:
{
test: /\.(css|scss)$/,
loaders: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ['css-loader?sourceMap', 'scss-loader?sourceMap']
})
}
Then I solve issue with:
{
test: /\.(css|scss)$/,
loaders: ['to-string-loader'].concat(ExtractTextPlugin.extract({
fallback: "style-loader",
use: ['css-loader?sourceMap', 'scss-loader?sourceMap']
}))
}