This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
Capacitor: running @nxext/capacitor:cap sync causes prepare script of installed capacitor plugins to trigger #4
Labels
bug
Something isn't working
Describe the bug
We are using @nxext/capacitor 16.3.0
We have installed https://github.com/capacitor-community/file-opener
This capacitor plugin has a prepare step in its package scripts, which causes:
So running sync effectively causes the file-opener plugin to self-destruct.
To Reproduce
I suspect this is due to our project level package.json usage with relative paths to the global node_modules:
So in the package.json in apps/, we insert capacitor plugins like this:
"@capacitor-community/file-opener": "../../node_modules/@capacitor-community/file-opener"
And in our global package.json in the nx workspace we include the plugin with the version we want.
We've done this to prevent duplicate version definitions and not having to deal with project level package definitions/installations.
I think this is also why we have never had this issue: #6
Maybe we ended up doing this because of that issue, I do not remember.
This relative link setup works great for 15 other capacitor plugins already and now that prepare step in file-opener breaks it.
If I instead just put the version in the project level file this bug goes away, but obviously that can cause that issue 978 and is just not very pretty in general, having an extra project level installed lib just for this one case.
Expected behavior
@nxext/capacitor should not causes the prepare step to trigger. I guess it calls that step because it tries to npm install the project level dependencies? Maybe there could be an option to skip that entirely? At least there is nothing really it needs to npm install in our setup, that is handled by the global node_modules
I'll also report this in file-opener, as it seems to be a bit of a unicorn with having a prepare step, many other capacitor plugins do not have it and work fine for our setup.
The text was updated successfully, but these errors were encountered: