Reputation: 69
I get the error message of:
ERROR in ./src/assets/css/site.scss
Module parse failed: C:\_Code\vscode\angular2-webpack-starter\src\assets\css\site.scss Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type.
| @import "_variables.scss";
| @import "_helpers.scss";
| html {
@ ./src/app/app.component.ts 5:0-34
@ ./src/app/app.module.ts
module: {
loaders: [
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&minetype=application/font-woff"
}, {
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&minetype=application/font-woff"
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&minetype=application/octet-stream"
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: "file"
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&minetype=image/svg+xml"
},{
test: /\.sass$/,
loaders: ["style", "css", "sass"]
}
,{
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}],
rules:[...]
//Other random code from webpack starter kit
};
The code below works correctly
//Works
require("!style-loader!css-loader!sass-loader!../assets/css/site.scss");
//Doesn't work
require('../assets/css/site.scss');
Already tried the following config options
{test: /\.scss$/,
loaders: ["style-loader", "css-loader", "sass-loader"]}
loaders: ["style", "css", "sass"]
loader: '!style-loader!css-loader!sass-loader!'
loader: 'style-loader!css-loader!sass-loader'
I want to load from the webpack config, but doesn't seem to be working. The project is practically the entire of the Angular 2 webpack starter.
The correct packages are all installed as dependencies and I've read the tutorials and every solution I can find on Google.
Upvotes: 0
Views: 259
Reputation: 28600
This is what I'm using and it works :
{
test: /\.scss$/,
use: ['to-string-loader', 'css-loader', 'sass-loader']
},
and install
"style-loader
"to-string-loader
"sass-loader
"node-sass
"css-loader
Upvotes: 1