3

I am currently working on a Firefox extension, but I am facing an issue with webpack bundling. Since Firefox requires me to upload the source code of my addon, the reviewer must be able to create the same build as I did. However, I am encountering a problem where Webpack always creates a different build, which makes it impossible for the reviewer to replicate my exact build.

To be more specific, the builds are same on the same system, but when I make build on my Mac and then on Linux, they end up being different.

Here is my webpack config:

  mode: 'production',
  optimization: {
    chunkIds: 'deterministic',
    moduleIds: 'deterministic',
    minimize: false,
    runtimeChunk: false,
    splitChunks: {
      chunks(chunk) {
        return chunk.name !== 'contentScript'
      },
      minChunks: 3,
      maxSize: 3500000
    }
  }
})

Do you have any advices on how to solve this? If you have any questions, feel free to ask!

Petr Špác
  • 113
  • 2
  • 10
  • Have you tried disabling `optimization`? Does that result in a deterministic build? If not, you'll know that your problem lies somewhere outside of that key. – Slbox Apr 13 '23 at 21:55
  • 1
    Use Webpack's `HashedModuleIdsPlugin` plugin to generate consistent module IDs. By default, Webpack generates module IDs based on the order of the modules in your code, which can change between builds. The `HashedModuleIdsPlugin` generates a hash based on the module's file path and content, which ensures that the same ID is assigned to the same module across builds. – Noor Fahad Apr 19 '23 at 11:22

0 Answers0