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

Non-deterministic order of glob imports #9946

Open
filips123 opened this issue Sep 7, 2024 · 0 comments
Open

Non-deterministic order of glob imports #9946

filips123 opened this issue Sep 7, 2024 · 0 comments

Comments

@filips123
Copy link

🐛 bug report

When using glob imports, the order of imports in the bundle can differ each time the package is built.

🎛 Configuration (.babelrc, package.json, cli command)

See in the code sample below.

🤔 Expected Behavior

When the same source code is built multiple times, the result should be completely the same. This includes the order of imports, names of minified variables, and hashes in filenames.

😯 Current Behavior

The order in which files imported with glob import are included in the bundle can be different each time. This also causes the filename hashes to differ.

Here are two build results, produced after running yarn build from the same source (available below) multiple times:

There is a difference between the order of bundled JSON files in manage.6e285bee.js and manage.5d13f5f6.js. Specifically, the import ihRmT is on different positions. I've also seen other variations, but I haven't saved them.

Note that in this case, the first version here is the most common. I had to run yarn build around 5 times before the second version was generated. But in another attempt, variations were more common.

🔦 Context

I'm using Parcel to build a Firefox extension. Because of this non-deterministic builds, the extension failed the review, as Firefox policies require that all extensions are reproducible from source.

💻 Code Sample

The extension I'm trying to build is available on GitHub.

The exact line where I'm using glob imports is here. I also have a custom transformer here for locales, but I'm not sure if this if the reason for the issue.

The exact source that I used to build the above examples (same as in the repository, but with version set in a few files):

🌍 Your Environment

Software Version(s)
Parcel v2.12.0
Node v20.15.0
npm/Yarn Yarn v1.22.22
Operating System Windows 11
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

1 participant