D
D
Dubolom Unicellular2020-07-24 16:29:37
JavaScript
Dubolom Unicellular, 2020-07-24 16:29:37

Why doesn't webpack update scss code after build?

Why doesn't webpack update scss code after build?
webpack.config.js:

const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
  mode: "production",
  entry: {
    home: "./src/assets/js/pages/home/home.js",
    projects: "./src/assets/js/pages/projects/projects.js"
  },
  output: {
    path: path.resolve(__dirname, "./dist"),
    filename: "[name].js",
    publicPath: "/dist"
  },
  module: {
    rules: [{
      test: /\.js$/,
      loader: "babel-loader",
      exclude: "/node_modules/"
    }, {
      test: /\.scss$/,
      use: [
          "style-loader",
          MiniCssExtractPlugin.loader,
          {
            loader: "css-loader",
            options: { sourceMap: true }
          },
          {
            loader: "postcss-loader",
            options: { sourceMap: true, config: { path: 'src/assets/js/postcss.config.js' } }
          },
          {
            loader: "sass-loader",
            options: { sourceMap: true }
          }
        ]
    }]
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: "styles.css"
    })
  ],
  devServer: {
    port: 5500,
  }
}

For example, if I change the color of the text to white, run the command npm run build, then nothing will change in the bundle, although it writes what I compiled styles.scssinto styles.css
. If I start the server via webpack-dev-server, everything will work.
???

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question