peerigon / extract-loader

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

undefined image src if image used twice in html #84

Open mbibko opened 4 years ago

mbibko commented 4 years ago

webpack.config.js

  mode: 'development',
  module: {
    rules: [
      {
        test: /\.html$/i,
        use: ['file-loader?name=[name].[ext]', 'extract-loader', 'html-loader'],
      },
      {
        test: /\.jpg$/,
        use: ['file-loader?name=[name].[ext]'],
      }
    ],
  },
};

src/index.js import './index.html'

src/index.html

<img src="img.jpg">
<img src="img.jpg">

src/img.jpg simple image

When I run webpack, it generates index.html file with this html:

<img src="img.jpg">
<img src="undefined">

The first img tag has correct src, but the second src is undefined.

I think problem with extract-loader. Thanks for help.

vseventer commented 4 years ago

@mbibko Fixed in #83