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

PnP loader chokes on certain packages #2461

Closed
jleedev opened this issue Aug 12, 2022 · 2 comments
Closed

PnP loader chokes on certain packages #2461

jleedev opened this issue Aug 12, 2022 · 2 comments

Comments

@jleedev
Copy link

jleedev commented Aug 12, 2022

Using version 0.15.1.

This works with node_modules, but not with PnP:

echo {} >package.json
 ¶ yarn set version stable
 ¶ yarn add esbuild osmtogeojson
 ¶ echo 'import "osmtogeojson"' | yarn exec esbuild --bundle          
✘ [ERROR] Do not know how to load path: .yarn/cache/osmtogeojson-npm-3.0.0-beta.4-5532f069b5-ce2199680e.zip/node_modules/osmtogeojson/osmtogeojson
 ¶ echo 'import "osmtogeojson/index.js"' | yarn exec esbuild --bundle
✘ [ERROR] Do not know how to load path: .yarn/cache/@mapbox-geojson-rewind-npm-0.4.0-25b0818717-82020c6324.zip/node_modules/@mapbox/geojson-rewind/geojson-rewind

Works with node_modules:

 ¶ yarn config set nodeLinker node-modules 
 ¶ yarn
 ¶ echo 'import "osmtogeojson"' | yarn exec esbuild --bundle | head 
(() => {
  var __create = Object.create;
[etc…]

Also works with the @yarnpkg/esbuild-plugin-pnp.

I think what these two packages (osmtogeojson and @mapbox/geojson-rewind) have in common is a package.json, containing a bin key, whose values contain file names that don't end in .js, but I'm not sure. Could also be just the presence of a file with the same name as the package (and no .js suffix).

@jleedev
Copy link
Author

jleedev commented Aug 12, 2022

Yes, this works:

 ¶ zip -d .yarn/cache/osmtogeojson-npm-3.0.0-beta.4-5532f069b5-ce2199680e.zip node_modules/osmtogeojson/osmtogeojson 
deleting: node_modules/osmtogeojson/osmtogeojson
 ¶ echo 'import "osmtogeojson"' | yarn exec esbuild --bundle
(ok)

Curiously, this doesn't:

echo 'import "osmtogeojson/index.js"' | yarn exec esbuild --bundle
✘ [ERROR] Do not know how to load path: .yarn/cache/@mapbox-geojson-rewind-npm-0.4.0-25b0818717-82020c6324.zip/node_modules/@mapbox/geojson-rewind/geojson-rewind

But this makes it work:

 ¶ zip -d .yarn/cache/@mapbox-geojson-rewind-npm-0.4.0-25b0818717-82020c6324.zip node_modules/@mapbox/geojson-rewind/geojson-rewind

@evanw
Copy link
Owner

evanw commented Aug 12, 2022

Closing as a duplicate of #2455. It looks like the same underlying issue.

@evanw evanw closed this as not planned Won't fix, can't repro, duplicate, stale Aug 12, 2022
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