Search code examples
manifestassetsversioningmanifest.jsonwebpack-encore

Symfony manifest asset versioning creates multiple files


I'm using Symfony (v4.1) for one of my projects.

As I wanted to try out the manifest versioning I enabled it on dev environment. I'm pretty sure it's not a good practice as it takes more time to build the assets up, but well... curiosity.

I realized that while using manifest versioning I'm building up the new asset every time I change something, which is correct, but it seems like the old asset is not being removed.

I'm not sure if it's a desired behavior, but is there any way to remove the old file by configuring the Symfony's Encore? Or am I not understanding this correctly and the old file is still needed for something?


Solution

  • No old files are not needed. There is the 'cleanup-webpack-plugin' you can enable by using:

    Encore
        .cleanupOutputBeforeBuild()