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

yarn pnp transpile issue - (@cloudflare wrangler + mime types) #2455

Closed
zerdos opened this issue Aug 11, 2022 · 4 comments
Closed

yarn pnp transpile issue - (@cloudflare wrangler + mime types) #2455

zerdos opened this issue Aug 11, 2022 · 4 comments

Comments

@zerdos
Copy link

zerdos commented Aug 11, 2022

No description provided.

@zerdos
Copy link
Author

zerdos commented Aug 11, 2022

The output bundles sides by sides, with some sort explanation:
zerdos/spike.land@b497a40#r80882280

@evanw
Copy link
Owner

evanw commented Aug 11, 2022

Sorry but I have no idea what you're trying to say. It looks like you're saying esbuild is now using Yarn PnP resolution rules, which is expected. This was recently announced: https://github.com/evanw/esbuild/releases/tag/v0.15.0. Marking this issue as unactionable because I don't know what to do with this issue.

@zerdos
Copy link
Author

zerdos commented Aug 11, 2022

Sorry if I was unclear - here is a better example.

When trying to bundling this code:

const mime = require('mime');

console.log(mime.getType('txt'));                       // ⇨ 'text/plain'             
console.log(mime.getExtension('text/plain'));   // ⇨ 'txt'

With nodeLinker: node-modules esbuild produces the expected bundle, but with nodeLinker: pnp the bundle will have a type error.

Also during the bundling now I got a warning, which say:
▲ [WARNING] Use "../../.yarn/global/cache/mime-npm-3.0.0-8d911e4c06-9.zip/node_modules/mime/Mime.js" instead of "../../.yarn/global/cache/mime-npm-3.0.0-8d911e4c06-9.zip/node_modules/mime/mime.js" to avoid issues with case-sensitive file systems [different-path-case]

example.js:1:21:
  1 │ const mime = require('mime');

@evanw
Copy link
Owner

evanw commented Aug 11, 2022

Thanks. I can reproduce the issue now. I think that the cause is probably the trailing / that Yarn adds to the end of its paths. That's not how esbuild works internally so esbuild's internals aren't expecting the slash, and that means it fails to search for index.js correctly. I'll fix this.

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

2 participants