I am trying to write a custom webpack module to override or extend the current SCSS build in angular 6 with cli 6, with the intention of being able to pass in a 'brand' and match it to any overrides e.g "somemodule/'brand'/filename.override.scss" and replace the file in parent folder "somemodule/filename.scss" but I am making no progress.
Set up: @angular/cli": "6.2.2", with @angular-builders/custom-webpack": "^2.4.1"
I have updated my projects build to reflect that I am using custom webpack, and the location of of override/extention
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./extra-webpack.config.js"
},
My extra-webpack.config.js looks like this, just a basic hello world style I have seen over many sites
module.exports = {
module:{
rules: [{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "sass-loader",
options: {
includePaths: ["src"]
}
}]
}]
}
};
however running my build with this
ng run websitename:build
throws this error
Module build failed (from ./node_modules/sass-
loader/lib/loader.js):
^
Invalid CSS after "": expected 1 selector or at-
rule, was "var content = requi"
From my understand this can be caused when trying to redefine the scss rule, however I can not see any other references to this rule to remove. I have also attempted some methods for completely override the old rule but no luck.
Solutions and guides i have been mainly focused on https://dev.to/meltedspark/customizing-angular-cli-6-buildan-alternative-to-ng-eject-1oc4 https://medium.com/a-beginners-guide-for-webpack-2/webpack-loaders-css-and-sass-2cc0079b5b3a https://www.npmjs.com/package/@angular-builders/custom-webpack#custom-webpack-config-object https://github.com/webpack-contrib/sass-loader/blob/master/test/bootstrapSass/webpack.config.js https://github.com/webpack-contrib/sass-loader/issues/536 https://github.com/meltedspark/angular-builders