1 year ago

#237399

test-img

doox911

Webpack duplicates styles in html

My html:

<!-- head -->
<body>
  <script src="index.js"></script>
</body>

My webpack.config.js:

module: {
    rules: [
      { 
        test: /\.css$/,
         use: [
          { loader: 'style-loader' },
          { loader: 'css-loader' },
         ]
      },
    ],
  }

Dev dependecies:

"devDependencies": {
  "css-loader": "^6.6.0",
  "html-webpack-plugin": "^5.5.0",
  "style-loader": "^3.3.1",
  "webpack": "^5.69.1",
  "webpack-cli": "^4.9.2"
}

I'm running: webpack --mode=production or webpack --mode=development, but in html file, I see:

<style></style>
<style> // Equal content </style>

webpack

css-loader

webpack-style-loader

0 Answers

Your Answer

Accepted video resources