Answer the question
In order to leave comments, you need to log in
Why does it give an error when importing a scss file?
For some reason it gives an error when importing the index.scss file into index.js
index.js :
import './scss/index.scss'
webpack.config.js :
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: './index.js',
output: {
filename: 'build.[hash].js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.html'
}),
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: 'bundle.[hash].css'
})
],
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
],
},
],
}
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question