Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different hash name #9

Open
Bulldozer323 opened this issue Nov 7, 2020 · 1 comment
Open

Different hash name #9

Bulldozer323 opened this issue Nov 7, 2020 · 1 comment

Comments

@Bulldozer323
Copy link

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?

@rolion
Copy link

rolion commented Jun 10, 2021

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]',
                        }
                    }
                ]
            },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants