Parcel is a fantastic zero-configuration build tool for front-end development. It's super fast and requires a minimal amount of setup. It works very well without requiring you to do very much — at least until it starts reporting somewhat opaque error messages.
I recently tried to build a parcel package for a project and encountered this.
@parcel/optimizer-swc: the name `$b5ace501ac48e74d$export$2e2bcd8739ae039` is defined multiple times
What the heck is
$b5ace501ac48e74d$export$2e2bcd8739ae039? What file causing this error? Why does it work when I use the
parcel command by itself, but not when I run
parcel build? I didn't know, but I sure spent the better part of a work day trying to decipher what this error message means and how to resolve it.
The fix was quite easy, but it took awhile to track down: check your files for duplicate default exports. Because of some copy-paste fumbles, and old code, I ended up with a couple of files that had
export default class Hooligan or somesuch and a repeated
export default at the end of the file. When the parcel optimizer runs during the build process, it reports the error. It does not appear otherwise.1
I hope this post saves you some confustion and debugging time.
At least, not with the default configuration. You may be able to change a setting and have Parcel report errors. I haven't tried to do so. ↩