Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined image src if image used twice in html #84

Open
mbibko opened this issue May 14, 2020 · 1 comment · Fixed by LeadingReach/extract-loader#1
Open

undefined image src if image used twice in html #84

mbibko opened this issue May 14, 2020 · 1 comment · Fixed by LeadingReach/extract-loader#1

Comments

@mbibko
Copy link

mbibko commented May 14, 2020

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
Copy link
Contributor

@mbibko Fixed in #83

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants