question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filename hash will be affected

See original GitHub issue

When the following options are enabled, contenthash will be affected and failed to load chunks. (Webpack 5)

const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const WebpackObfuscator = require("webpack-obfuscator");

module.exports = {
  mode: "production",
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "[name].js",
    // chunkFilename: "[name].[chunkhash:8].js", // ✅
    chunkFilename: "[name].[contenthash:8].js", // ❌
  },
  plugins: [
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin(),
    new WebpackObfuscator(
      {
        splitStrings: true,
        splitStringsChunkLength: 5,

        stringArray: true,
        stringArrayEncoding: ["rc4"],
        stringArrayIndexShift: true,
        stringArrayWrappersCount: 5,
        stringArrayWrappersChainedCalls: true,
        stringArrayWrappersParametersMaxCount: 5,
        stringArrayWrappersType: "function",
        stringArrayThreshold: 1,
      },
      []
    ),
  ],
};

Reproduce repo: https://github.com/sxzz/webpack-obfuscator-test

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sanex3339commented, Feb 3, 2021

Released as 3.3.0. Please try it.

0reactions
sanex3339commented, Feb 3, 2021

I don’t know if this change could produce any side-effects, so please let me know if you found any problems

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does the hash of a file change if the filename changes?
The hash of a file is the hash of its contents. Metadata such as the file name, timestamps, permissions, etc. have no influence...
Read more >
Will changing a file name affect the MD5 Hash of a file?
No, the hash is of the file contents only. You can see this in the source for md5sum and its MD5 implementation. You...
Read more >
Adding Hashes to Filenames - SurviveJS
Including hashes related to the file contents to their names allows to invalidate them on the client-side. If a hash has changed, the...
Read more >
Hash changes if a filename is changed · Issue #1479 - GitHub
I'm unable to get this working with the webpack-md5-hash plugin at all, I still get different hash names on my files for the...
Read more >
File Name Hashing: Creating a Hashed Directory Structure
Most modern file systems do not limit the number of files you can store in a single directory. However, depending on the type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found