How to install @ionic-native/file-chooser from forked repository via npm?

I want to extend @ionic-native/file-chooser@4 functionality to use it in my legacy project. I made fork from ionic-team/ionic-native, made and commited changes into a separate branch. But now I faced the problem that I’m not able to put correct link at package.json to install @ionic-native/file-chooser from my fork.

Branch with my changes: feat/file-chooser

I have tried:

git ls-remote https://github.com/alexverbitsky/ionic-native.git@ionic-native/file-chooser#feat/file-chooser
git ls-remote https://github.com/alexverbitsky/ionic-native.git@ionic-native/file-chooser.git
git ls-remote https://github.com/alexverbitsky/ionic-native.git@ionic-native/plugins/file-chooser

and so on. And no one link gave me acceptable response

To sum up: I need to find out the correct link to install @ionic-native/file-chooser from fork from particular branch. The solution that would help me looks like:

"@ionic-native/file-chooser": "git+https://github.com/alexverbitsky/ionic-native.git@ionic-native/file-chooser#feat/file-chooser"

string in package.json.
Please help me to find out the correct one

1 Like

I’ve stumbled upon a similar problem with a different plugin (@ionic-native/firebase-dynamic-links) and had the same question.

A tricky thing about @ionic-native is that they publish the plugin wrappers with npm scripts (e.g. by running npm run build and npm run npmpub) under their respective URLs. In other words, each plugin wrapper has a corresponding npm package but not a separate Git repo, so you can’t refer to to individual wrappers via Github URLs directly (in your package.json file).

Here are possible workarounds:

  1. Copy @ionic-native plugin package locally, make changes, add to your Git repo, and install your modified npm package locally with npm install /path/to/your/folder
  2. Fork the plugin on Github, make changes (optionally: submit a Pull request), publish the modified plugin as a separate npm package, then install your npm package as you normally would (npm install your-modified-npm-package). Note: you might want to publish a scoped package