Skip to content

Multiple images with same name #246

Closed
@graille

Description

@graille

Hi,

I've found an issue with Encore's image management when files have the same name
My assets/images folder loke like this :

.
├── backgrounds
│   ├── bg-1.jpg
├── bg-1.png

In my app.js, I call each static images used by my project (in JS or CSS files) one by one (@images is a webpack alias):

    // Images
    require('@images/logo.png')
    require('@images/backgrounds/bg-2.png')
    require('@images/bg-2.png')

(The problem is the same if files are referenced in a CSS file and not in a JS file)
But at the end, each images are moved in public/build/images directory :

.
├── app.8953b1aef7032187ce84.js
├── images
│   ├── bg-2.4972df67.png
│   ├── bg-2.68831990.png
│   └── logo.4972df67.png
└── manifest.json

But the manifest.json does not reference the two images :

{
  "build/app.js": "/build/app.8953b1aef7032187ce84.js",
  "build/images/bg-2.png": "/build/images/bg-2.4972df67.png",
  "build/images/logo.png": "/build/images/logo.4972df67.png"
}

Idea :
Would it not be better to have the same file tree in the public/build/images directory ? Something like this :

.
├── app.vue.8953b1aef7032187ce84.js
├── images
│   ├── backgrounds
│   │   └── bg-2.4972df67.png
│   ├── bg-2.68831990.png
│   └── logo.4972df67.png
├── manifest.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions