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

Two entries with the same name in different directories lead to "Two output files share the same path" #244

Closed
matthewmueller opened this issue Jul 9, 2020 · 3 comments

Comments

@matthewmueller
Copy link

matthewmueller commented Jul 9, 2020

Problem

Given the following file structure:

.
├── a
│   └── index.js
└── b
    └── index.js

If you run:

esbuild --bundle --outdir=dist --format=esm a/index.js b/index.js

You get the following error:

error: Two output files share the same path: dist/index.js

Possible Solution

I think I'd expect the bundle output to look like this:

dist
├── a
│   └── index.js
└── b
    └── index.js

So it seems like there'd need to be a base directory (defaulting to working directory) so you could do:

const rel = path.relative(basedir, entry)
const outpath = path.join(outdir, rel)
@matthewmueller matthewmueller changed the title Same file name in different directory leads to "Two output files share the same path" Two entries with the same name in different directories lead to "Two output files share the same path" Jul 9, 2020
@nitsky
Copy link
Contributor

nitsky commented Jul 10, 2020

@matthewmueller see #224 which reports the same issue and suggests a solution similar to how Rollup handles this.

@matthewmueller
Copy link
Author

Thanks, I see it now. I personally think this issue is a bit more focused on the problem. Having the exact error message in the issue title makes it more discoverable for others too.

I agree that customizing the names of chunks, assets, and entrypoints is nice to have (I use these features in rollup too), but even without any of those options, rollup and tsc handle this for you.

Let's do this. I'll close this issue and write a comment in #224.

@evanw
Copy link
Owner

evanw commented Jul 11, 2020

This should be fixed as of version 0.6.0.

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