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

Incompatible with npm link or yarn link #233

Open
acao opened this issue May 13, 2019 · 4 comments
Open

Incompatible with npm link or yarn link #233

acao opened this issue May 13, 2019 · 4 comments

Comments

@acao
Copy link

acao commented May 13, 2019

It seems this project is incompatible with yarn link and npm link. I'm a maintainer for graphiql, part of the GraphQL working group, and we have ~9 linked repositories that we have to add an empty and temporary "browserify-shim": {}, entry to in order to build the application across these linkages. Any suggestions on how to make this an easier project for our contributors?

@acao acao changed the title Incompatible with npm link or yarn link Incompatible with npm link or yarn link May 13, 2019
@bendrucker
Copy link
Collaborator

Per the discussion in #208, I don't see how we can get past this. The only way browserify-shim has available to look up the relevant configuration is by traversing upwards and looking for package.json. I don't see how we can relax that restriction without breaking a key piece of validation.

I would consider a PR letting the user opt in and skip configuration lookup for specific packages, effectively preventing browserify-shim from operating on them. That's a pretty sloppy workaround but I don't see any way we can reasonably support npm link out of the box.

@acao
Copy link
Author

acao commented May 13, 2019

Hmm I can see how that's an issue. Just wanted to note that it's a fairly common development pattern, and symlinks are also used by monorepo tooling such as lerna. Seems that some tools such as eslint have figured this out, but I doubt it was easy

@bendrucker
Copy link
Collaborator

The specific issue here is that:

  1. browserify-shim is configured via package.json (not uncommon)
  2. browserify-shim can be configured by any package in the tree, via the nearest ancestor package.json (very uncommon)

Something like eslint gets past this because the configuration's presence in package.json is for convenience, and not for mimicking the require algorithm as b-shim does. You can't, for example, specify eslint configuration for a specific sub-package by placing it in the sub-package's package.json file.

@bendrucker
Copy link
Collaborator

Browserify passes the original file path to the transform so AFAIK we have no way to get the symlink's path, only the underlying realpath.

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