I tried to solve a similar problem styleUrls Angular 2 styles imported through styleUrls . I thought that I would add my decision as a complement to the accepted answer for posterity.
This solution distinguishes styles of components that need to be loaded using to-string-loader , unlike other styles that can be loaded using style-loader .
If you configure the components as follows:
@Component({ selector: 'admin', styleUrls: ['./admin.component.scss'], templateUrl: './admin.component.html' })
You can use the following rules:
// For components `to-string-loader` { test: /\.css$/, use: ['to-string-loader', 'css-loader'], include: /\.component\.css$/ }, // For non-components `style-loader` { test: /\.css$/, use: ['style-loader', 'css-loader'], exclude: /\.component\.css$/ }
source share