Assets are loaded from hashed path instead of its corresponding from manifest.json

Viewed 490

I've enabled file versioning and configured to export everything from the /assets/images path to /public/build/images and all files have their own hashes.In theory, manifest.json is built and using twig's asset function the given file must be read with its non-hashed filename (that corresponds to the hashed one), but it does not work.It still shows only hashed ones, why does that happen?

var Encore = require('@symfony/webpack-encore');

if (!Encore.isRuntimeEnvironmentConfigured()) {
    Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}

Encore
    .setOutputPath('public/build/')
    .setPublicPath('/build')
    .addEntry('app', './assets/js/app.js')
    .splitEntryChunks()
    .enableSingleRuntimeChunk()
    .cleanupOutputBeforeBuild()
    .enableBuildNotifications()
    .enableSourceMaps(!Encore.isProduction())
    .enableVersioning()
    .configureBabelPresetEnv((config) => {
        config.useBuiltIns = 'usage';
        config.corejs = 3;
    })
    .enableSassLoader()
    .copyFiles({
        from: './assets/images',
        to: 'images/[path][name].[hash:8].[ext]',
    })
;

module.exports = Encore.getWebpackConfig();

Assets.yaml is properly configured:

framework:
    assets:
        json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
0 Answers
Related