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

File loader issue with duplicate filenames in dev mode #445

Closed
arunoda opened this issue Aug 15, 2016 · 0 comments
Closed

File loader issue with duplicate filenames in dev mode #445

arunoda opened this issue Aug 15, 2016 · 0 comments
Milestone

Comments

@arunoda
Copy link
Contributor

arunoda commented Aug 15, 2016

This happens when there's a media file with the same file name but in different directories. Here's a sample app: https://github.com/arunoda/file-loader-cra-issue

Here's the related code:

import React, { Component } from 'react';
import abcHeader from './abc/header.png';
import bbcHeader from './bbc/header.png';
import './App.css';

class App extends Component {
  render() {
    return (
      <div className="App">
        <div className="App-header">
          <img src={abcHeader} alt="ABC Header"/>
          <img src={bbcHeader} alt="BBC Header"/>
        </div>
      </div>
    );
  }
}

export default App;

As you see both pngs has the same name. Now in the dev mode, it tries to load the first file in all the case.

We could easily fix this by hashing the filename in dev mode too.
I came across this while playing with React Storybook.

arunoda added a commit to arunoda/create-react-app that referenced this issue Aug 15, 2016
This will work correctly when there are duplicate filenames in different paths.
Fixes: facebook#445
gaearon pushed a commit that referenced this issue Aug 15, 2016
This will work correctly when there are duplicate filenames in different paths.
Fixes: #445
@gaearon gaearon added this to the 0.3.0 milestone Aug 15, 2016
gaearon pushed a commit that referenced this issue Aug 22, 2016
This will work correctly when there are duplicate filenames in different paths.
Fixes: #445
@gaearon gaearon modified the milestones: 0.2.2, 0.3.0 Aug 22, 2016
stayradiated pushed a commit to stayradiated/create-react-app that referenced this issue Sep 7, 2016
This will work correctly when there are duplicate filenames in different paths.
Fixes: facebook#445
feiqitian pushed a commit to feiqitian/create-react-app that referenced this issue Oct 25, 2016
This will work correctly when there are duplicate filenames in different paths.
Fixes: facebook#445
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants