I am using mini-css-extract-plugin
with Webpack 4 like such:
module: {
rules: [
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('webfonts/[name].[hash:7].[ext]')
}
}
},
{
test: /\.css?$/,
use: [
'css-loader',
{
loader: MiniCssExtractPlugin.loader,
options: {
sourceMap: !isProduction,
// only enable hot in development
hmr: !isProduction,
// if hmr does not work, this is a forceful method.
reloadAll: true,
},
},
]
},
For some reason I am getting an error due to a @font-face
import in my css file. The error is like this:
ERROR in ./src/assets/css/site.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleParseError: Module parse failed: Unexpected character '@' (77:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| @font-face { font-family: "MySans"; font-style: normal; font-weight: 800; src: local('☺'),
Why is mini-css-extract-plugin tripping on @font-face
and is there a fix?