1. Components:
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: require('./app.component.html'),
styles: [ require('./app.component.scss') ]
})
export default class AppComponent{
}
2. Configuration in webpack:
...
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract( 'style-loader', 'raw-loader!css-loader!sass-loader' ),
exclude: /node_modules/
}
...
3. Report in the browser Uncaught Error: Expected 'styles' to be an array of strings.
4. How to extract scss files?
Please use styleUrls, raw-loader should be executed last. However, if you need to AOT compile after using require, you will be in trouble.