Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 1

Mini-css-extract-plugin - how grap the hash naming on index.html

I try currently to implement mini-css-extract-plugin.

I fail to implement hash naming, when I use it I don't know how lead my index.html file to grap the specific name on the fly.

If someone has any idea would be great.Thanks

Here my webpack.config.js :

plugins: [
    new MiniCssExtractPlugin({
      // Options similar to the same options in webpackOptions.output
      // both options are optional      filename: 'styles.[contenthash].css'
module: {   rules: [ {     test: /\.js|jsx$/,     exclude: /node_modules/,   include: path.resolve(__dirname, "src"),
     use: [
       {   loader: "babel-loader",   options: {     presets: ["es2015", "stage-1", "react"]

   {   test: /\.css$/,
   use: [{     loader: MiniCssExtractPlugin.loader,     options: {       publicPath: "./public"
   }, {     loader: "css-loader"


here my index.html:

<link rel="stylesheet" href="styles.css">

how translate in my html the "[contenthash]" part of my css filename in order to grap the css filename ?