assets-webpack-plugin icon indicating copy to clipboard operation
assets-webpack-plugin copied to clipboard

Output always includes hash since 7.1

Open DysphoricUnicorn opened this issue 3 years ago • 1 comments

Describe the bug

Because Webpack will use way too much memory when it's left watching files during a whole workday if the output files include a hash in their name, we set it up to only include the hash on production.

This worked fine, however since version 7.1, the output paths will always include a hash, even if the actual files do not.

To Reproduce

This config works fine in 7.0 but breaks in 7.1

output: {
            path: path.join(__dirname, '..', 'static', 'js'),
            publicPath: '/static/js',
            filename: isDevelopment ? 'webapp.[name].js' : 'webapp.[contenthash].js',
        },

Since 7.1, the output will always look like:

{"main":{"js":"./static/js/webapp.[$hash].js"}}

Expected behavior The output only contains hashes if the file it's referring to does as well.

It should look something like:

{"main":{"js":"./static/js/webapp.main.js"}}

Desktop (please complete the following information):

  • OS: Linux / Docker
  • Node version: 12
  • Plugin version: 7.1.0

DysphoricUnicorn avatar Apr 28 '21 09:04 DysphoricUnicorn

Thanks for the report, I'll take a look when I get a chance.

ztoben avatar Apr 28 '21 12:04 ztoben