"Unknown word" error showing after adding postcss-loader
I kept getting "unknown word" error as well. It was a result that css cannot read comments with // but scss can... So I had to add the postcss-scss
to the options after installing it with:
npm --save install postcss-scss
or (if you use Yarn)
yarn add --dev postcss-scss
(webpack.config.js)
const WebpackNotifierPlugin = require('webpack-notifier');
const path = require('path');
module.exports = {
module: {
rules: [
{
test: /\.scss$/,
loader: 'postcss-loader',
options: {
ident: 'postcss-scss',
syntax: 'postcss-scss',
plugins: () => [require('postcss-flexbugs-fixes')()]
}
}
]
},
plugins: [
new WebpackNotifierPlugin({
alwaysNotify: true,
title: 'Enterprise',
contentImage: path.join(__dirname, 'image.png')
})
]
};
This might help someone, or me later again.
I got this error because instead of
@import '../../common.scss';
In my SCSS, I had mistakenly written
@import url('../../common.scss');
Removing the url() function got rid of the error.