asset-require-hook icon indicating copy to clipboard operation
asset-require-hook copied to clipboard

Different hash name

Open Bulldozer323 opened this issue 4 years ago • 1 comments

Hi, i use module with such config:

assetRequireHook({
    extensions: ['jpg', 'png', 'gif', 'svg'],
    publicPath: '/',
});

And file-loader as:

test: /\.(svg|png|jpg|gif)$/,
use: {
    loader: 'file-loader',
    options: {
        name: '[hash].[ext]',
    },
},

But i get different file name from file-loader and module, example:

module – cba2c82d0b1e651b5b486aa2433d24a8.png file-loader – 63acfdc0e9ea8e6e0e50b2178255dc88.png

How can i get the same file names?

Bulldozer323 avatar Nov 07 '20 16:11 Bulldozer323

you have to specifie the type of hashing for both of them, it seems that the default type is not same for any of them

require('asset-require-hook')({
    extensions: ['jpg', 'png', 'gif'],
    name: '/assets/[md5:hash].[ext]',
});
 {
                test: /\.(png|gif|jpg)$/,
                use: [
                    {
                        'loader': 'file-loader',
                        options: {
                            name: 'assets/[md5:hash].[ext]',
                        }
                    }
                ]
            },

rolion avatar Jun 10 '21 18:06 rolion