Webpack 4 isn't working for me. I mainly want it to compile SCSS to CSS here is the config file. Also, it does not throw any error just shows that it has been compiled. I'm sure it's lying :)
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const autoprefixer = require('autoprefixer');
module.exports = {
entry: {
App: './public/javascript/index.js'
},
devtool: "source-map",
output: {
path: path.resolve(__dirname, 'public', 'dist'),
filename: '[name].bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.(scss|css)$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader"
// options: {
// minimize: {
// safe: true
// }
// }
},
{
loader: "postcss-loader",
options: {
autoprefixer: {
browsers: ["last 2 versions"]
},
plugins: () => [
autoprefixer
]
},
},
{
loader: "sass-loader",
options: {}
}
]
},
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "./public/dist/style.css",
chunkFilename: "./public/dist/[id].css"
})
]
};
Also here is are the scrips that I'm running
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "nodemon ./start.js --ignore /public",
"dev": "concurrently \"npm run watch\" \"npm run assets\" --names \",\" --prefix name",
"assets": "webpack-dev-server --mode development"
},
So it isn't compiling, throws no error, and tells that the code has been compiled but no file can be seen in the destination folder.