Hi! I wonder why everytime I tried to install the custom version of ionic-native, with my plugin.ts and updated index.ts file included, it just doesn't work. I realized npm install ionic-native --save is installing a very different thing than what it's displayed here. For example, for each plugin.ts, it has a .js.map and some other file. This just never happens when I'm trying to install my own version of Ionic-Native.
I wonder how is it possible to test my newly developed plugin without submitting and forking? Thank you!
Installing via NPM would get you the NPM package, not what you see here on Github. The master branch here is more like a development branch (for now).
To build it yourself, clone the repo, run npm install to install any development dependencies and then run the command npm run build_bundle to compile the library. Then you will see the files in the dist directory.
I hope that helped, let me know if you have any further questions.
@ihadeed Thanks! : D It seems to work. And I wonder if there's a more efficient way of developing/testing individual wraps? For example, adding a new .ts file todist/plugins, update the index and then run npm run build_bundle again?
Not sure what the most efficient way is. But this is what I do:
I have a blank Ionic 2 app in another directory. Both the app and ionic-native are located in the same parent directory. The Ionic app imports ionic-native from ../ionic-native/dist/index. Then I follow these steps every time I want to test something out:
npm run build_bundle to build my new library (I can really skip this an import ../ionic-native/src/ but I do this to catch any build errors)chrome://inspect) to control the app through the consoleWhen I'm in the console, I just call the apps using IonicNative global variable. Example: IonicNative.Camera.getPicture(...).then(...)
Do let me know if you think of a more efficient way!
We should document this and maybe also add a watch task.
@kdenz after building ionic-native locally, run npm link from the ionic-native project root to create a global symlink to your local version, then from your app's directory run npm link ionic-native to replace the one in node_modules that you got from npm with the global symlink.
Steps:
cd ionic-native && npm install npm run build_bundle npm linkcd myapp npm link ionic-native Then any imports like import {Camera} from 'ionic-native' will use the symlinked version that points to your local ionic-native.
Just note for anyone else stumbling across this, it's now:
````
cd ionic-native && npm install
npm run build && npm run build:bundle
npm link
cd myapp
npm link ionic-native
````
I made a gist with my workflow. https://gist.github.com/K1N5L4Y3R/fbf0c05742870ee21810d55e7ba0b9c4
Most helpful comment
We should document this and maybe also add a watch task.
@kdenz after building
ionic-nativelocally, runnpm linkfrom theionic-nativeproject root to create a global symlink to your local version, then from your app's directory runnpm link ionic-nativeto replace the one innode_modulesthat you got from npm with the global symlink.Steps:
cd ionic-native && npm installnpm run build_bundlenpm linkcd myappnpm link ionic-nativeThen any imports like
import {Camera} from 'ionic-native'will use the symlinked version that points to your localionic-native.