const path = require("path");
let sassRule= {
test: /.sass|scss$/i,
use: ["style-loader", "css-loader", "sass-loader"],
}
module.exports = {
entry: path.resolve(__dirname, "/src/index.js") // import sass file on javascript file
module: {rules: sassRule}
}
const path = require('path');
const FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries");
module.exports = {
entry: [
__dirname + '/src/js/app.js',
__dirname + '/src/scss/app.scss'
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'js/app.min.js',
},
module: {
rules: [
{
test: /.js$/,
exclude: /node_modules/,
use: [],
}, {
test: /.scss$/,
exclude: /node_modules/,
type: 'asset/resource',
generator: {
filename: 'css/[name].min.css'
},
use: [
'sass-loader'
]
}
]
},
plugins: [
new FixStyleOnlyEntriesPlugin({ extensions:['scss'] }),
],
};