laravel-enso / enso

Laravel Vue SPA, Bulma themed. For demo login use `admin@laravel-enso.com` & `password` -
https://www.laravel-enso.com
MIT License
1.08k stars 277 forks source link

Enso images are not overwritten during build #262

Closed mauthi closed 4 years ago

mauthi commented 4 years ago

This is a bug.

Prerequisites

Description

I changed the plugin section in vue-config.js to the following:

plugins: [
            new CopyPlugin([{
                from: 'node_modules/@enso-ui/ui/src/resources/images',
                to: 'images',
                force: true,
                folder: true,
            }, {
                from: '../vendor/laravel-enso/core/src/resources/images',
                to: 'images',
                force: true,
                folder: true,
            }, {
                from: 'src/images',
                to: 'images',
                force: true,
                folder: true,
            }]),

In my client/src/images folder I have a file called logo.svg

Steps to Reproduce

  1. Create a folder client/src/images
  2. Change config in vue-config.js like described above
  3. Add a file called logo.svg to folder
  4. Run yarn run dev
  5. Check logo.svg in your public/images folder

Expected behavior

logo.svg should be the one from client/src/images

Actual behavior

logo.svg is the one from enso

(If I remove the first to config options from config and leave only my folder it's working - so I guess it's something related to execution order?)

gandesc commented 4 years ago

Hi Mauthi,

In order to reliably ensure that the local pictures are overwritten, the best way is to create an additional CopyPlugin instance, beneath the default one.

It seems that a CopyPlugin instance is running the copy processes concurrently, so overwriting the assets using the arguments order is not guaranteed.

        plugins: [
            new CopyPlugin([{
                from: 'node_modules/@enso-ui/ui/src/resources/images',
                to: 'images',
                force: true,
                folder: true,
            }, {
                from: '../vendor/laravel-enso/core/src/resources/images',
                to: 'images',
                force: true,
                folder: true,
            }]),
            new CopyPlugin([{
                from: 'src/images',
                to: 'images',
                force: true,
                folder: true,
            }]),
        ],

I'll also update the docs.

mauthi commented 4 years ago

Thx - it works