Skip to content

File loader issue with duplicate filenames in dev mode #445

Closed

Description

@arunoda

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.

Activity

  1. added a commit that references this issue on Aug 15, 2016
    9bdbb1b
  2. added a commit that references this issue on Aug 15, 2016
    7c912b5
  3. added this to the 0.3.0 milestone on Aug 15, 2016
  4. added a commit that references this issue on Aug 22, 2016
    d624756
  5. modified the milestones: 0.2.2, 0.3.0 on Aug 22, 2016
  6. added a commit that references this issue on Sep 7, 2016
    53bb28d
  7. added a commit that references this issue on Oct 25, 2016
    598cdb3
  8. locked and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions