Possible duplicate of #1929 but I'm not sure because that ticket is too vague.
esbuild determines content types based on file extension. esbuild docs
But yargs/yargs does not have a file extension.
This raises an error:
$ echo 'import createYargs from "yargs/yargs";' | yarn esbuild --bundle --loader=js
> <stdin>:1:24: error: Do not know how to load path: node_modules/yargs/yargs
1 │ import createYargs from "yargs/yargs";
╵ ~~~~~~~~~~~~~
1 error