Kocal / vue-web-extension

🛠️ A Vue CLI 3+ preset (previously a Vue CLI 2 boilerplate) for quickly starting a web extension with Vue, Babel, ESLint and more!
https://vue-web-extension.netlify.app/
MIT License
1.58k stars 167 forks source link

Built result will be different when environment change or node_modules be reinstalled #686

Open Taosky opened 2 years ago

Taosky commented 2 years ago

Describe the bug Build result will change when reinstall node_modules. This will lead to the problem of the source code review when the expanded store is launched. As I encountered, when upload to firefox addon center, the code-reviewer reminded the code built result differently from the uploaded code.

To Reproduce Steps to reproduce the behavior:

  1. npm run build
  2. Save production zip file
  3. Delete node_modules dir
  4. npm install && npm run build
  5. compare the two production file
Taosky commented 2 years ago
图片
spekulatius commented 2 years ago

Have you been able to identify the diff @Taosky?

Taosky commented 2 years ago

Have you been able to identify the diff @Taosky?

I just used diff command for comparison, It may be that some content is in a different order.I asked a friend to test it and the results showed different.

I turned off code compression, obfuscation and other functions through webpack configuration, but the problem still exists.

Finally, I switched to vue-cli-plugin-chrome-extension-cli, it has no such problem.

spekulatius commented 2 years ago

Have you been able to identify the diff @Taosky?

I just used diff command for comparison, It may be that some content is in a different order.I asked a friend to test it and the results showed different.

You mean files in a different order in the ZIP file?

I turned off code compression, obfuscation and other functions through webpack configuration, but the problem still exists.

Okay, interesting. I never had this issue...

Finally, I switched to vue-cli-plugin-chrome-extension-cli, it has no such problem.

Okay

Taosky commented 2 years ago

You mean files in a different order in the ZIP file?

What I mean is that the location of the final generated JS code in the file may change, or the variable name may change (sorry, I don't know much about the code after the build, in short, after each build, the generated code changed)

In most cases, this change will not cause problems, but mozilla requires that extensions that use webpack upload source code for review. I think they might use something like 'diff' in the background to compare the results.

When uploading to chrome webstore or microsoft store (Edge) there is no problem.

spekulatius commented 2 years ago

Yeah, I know Mozilla likes to have deterministic code. It's understandably desirable to have the same output each time, hence my surprise about the issue.

I'm happy you found a solution that works for you.