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

[FeatureRequest] reproducable build among npm and pnpm #1499

Closed
loynoir opened this issue Aug 5, 2021 · 6 comments
Closed

[FeatureRequest] reproducable build among npm and pnpm #1499

loynoir opened this issue Aug 5, 2021 · 6 comments

Comments

@loynoir
Copy link

loynoir commented Aug 5, 2021

Brief

When using package manager pnpm, compare with npm.
esbuild --bundle reproduce different output.

npm

// node_modules/fetch-blob/streams.cjs
var require_streams = __commonJS({
  "node_modules/fetch-blob/streams.cjs"() {
    // code
  }
});

pnpm

// node_modules/.pnpm/[email protected]/node_modules/fetch-blob/streams.cjs
var require_streams = __commonJS({
  "node_modules/.pnpm/[email protected]/node_modules/fetch-blob/streams.cjs"() {
    // code
  }
});
@loynoir
Copy link
Author

loynoir commented Aug 5, 2021

pnpm: Fast, disk space efficient package manager

repo: https://github.com/pnpm/pnpm
install: https://pnpm.io/installation

@evanw
Copy link
Owner

evanw commented Aug 5, 2021

The file path is the file path, and is not in esbuild's control. Non-minified output deliberately includes the file path because it's intended for debugging by a human. You will get different file paths with other different package managers too such as Yarn, which puts files inside zip files.

Relative file paths of input files are also included in the hashes present in output file names (a critical correctness feature for bugs such as #928), so even removing the file path comments and strings in the output files that you are pointing to does not guarantee reproducible builds.

Basically this is by design. Builds are only reproducible given the same file system contents. Use the same package manager if you want the same build output.

@hyrious
Copy link

hyrious commented Aug 5, 2021

You can use --minify-identifiers to remove the file path string in output.

@loynoir
Copy link
Author

loynoir commented Aug 5, 2021

You can use --minify-identifiers to remove the file path string in output.

@hyrious Seems not working on v0.12.17. I try --minify-whitespace, that works, thanks!

@loynoir
Copy link
Author

loynoir commented Aug 5, 2021

@evanw

Maybe provide --minify-path, for compactible build?
Is that possible?

@evanw
Copy link
Owner

evanw commented Oct 17, 2021

I'm closing this as "by design" as described above. The file structure is part of the input, and different inputs lead to different outputs.

@evanw evanw closed this as completed Oct 17, 2021
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

3 participants