peerigon / extract-loader

webpack loader to extract HTML and CSS from the bundle
The Unlicense
317 stars 74 forks source link

working incorrect with html-loader@1.1.0 #80

Closed YujieCheng closed 4 years ago

YujieCheng commented 4 years ago

config in webpack.js

module: {
    rules: [
      {
        test: /\.html$/,
        use: [
          "file-loader?name=[name].[ext]",
          "extract-loader",
          "html-loader"
        ]
      },
      {
        test: /\.(png|gif|jpg)$/,
        use: [
          {
            loader: "file-loader",
            options: {
              name: utils.assetsPath('img/[name].[ext]')
            }
          }
        ]
      }
    ]
  }

next code is I want to handle

<body>
  <img src="imgs/wechat.jpg">
  <img src="imgs/wechat.jpg">
  <img src="imgs/wechat.jpg">
  <img src="imgs/wechat.jpg">
  <img src="imgs/wechat.jpg">
</body>

when I use html-loader@1.1.0 ,the result is

<body>
  <img src=/static/img/wechat.jpg>
  <img src=undefined>
  <img src=undefined>
  <img src=undefined>
  <img src=undefined>
</body>

how reslove this problem ,should I use the previous version of html-loader?

YujieCheng commented 4 years ago

Nice! it solve the question.