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

manifest.json: Set filenames based on hash from file-loader #51

Open
magnusriga opened this issue Jun 6, 2018 · 1 comment
Open

manifest.json: Set filenames based on hash from file-loader #51

magnusriga opened this issue Jun 6, 2018 · 1 comment

Comments

@magnusriga
Copy link

Thanks for a good boilerplate.

I used file-loader to load my images into dist. They all get a random hash, based on contents (from caching purposes).

Is there any way to transform manifest.json, so its icons refer to the image files with the hash applied by file-loader?

Thank you.

@Xunnamius
Copy link

In case anyone is looking for an clue, have a look at the transform code invoked by CopyWebpackPlugin. For example, in my source:

new CopyWebpackPlugin([{
        from: paths.srcManifest,

        // ? Generates our manifest file using info from package.json
        transform: content => Buffer.from(JSON.stringify({
            name: `${DEV_ENV ? "DEV-" : ''}${pkg.name}`,
            description: pkg.description,
            version: pkg.version,
            'content_security_policy': `script-src 'self'${DEV_ENV ? " 'unsafe-eval'" : ''}; object-src 'self'`,
            ...JSON.parse(content.toString())
        }))
    }]),

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