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

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

Open
Taosky opened this issue Jul 13, 2022 · 6 comments

Comments

@Taosky
Copy link

Taosky commented Jul 13, 2022

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
Copy link
Author

Taosky commented Jul 18, 2022

图片

@spekulatius
Copy link
Contributor

Have you been able to identify the diff @Taosky?

@Taosky
Copy link
Author

Taosky commented Aug 29, 2022

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
Copy link
Contributor

spekulatius commented Aug 29, 2022

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
Copy link
Author

Taosky commented Aug 30, 2022

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
Copy link
Contributor

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.

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