Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #445
Closed
Open
Issue created Aug 15, 2016 by Administrator@rootContributor

File loader issue with duplicate filenames in dev mode

Created by: 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.

Assignee
Assign to
Time tracking