Closed
Description
This is an issue for tracking / planning what needs to be done in this plugin.
- Figure out how exactly Vue communicates with the devtools (
window.__VUE_DEVTOOLS_GLOBAL_HOOK__
I believe is where the hook needs to be injected) - Figure out the best / easiest way to get websockets working with ns
Idea: we could replace window.__VUE_DEVTOOLS_GLOBAL_HOOK__
using rollup in nativescript-vue core, with something like
try {
require('nativescript-vue-devtools')
} catch(e) {
Vue.config.debug && console.log('to use devtools install nativescript-vue-devtools blah blah')
}
Activity
damiani commentedon May 28, 2018
vue-devtools-init
event from the socket, but I haven't figured out how to get the hook injected in order to pick up the Vue instance running in NativeScript.rigor789 commentedon May 28, 2018
Awesome stuff, I haven't used a socket library in ns yet, but I know there are a few different ones - could be worth trying a few of them.
As for injecting the hook, I think the idea I added in the original issue about replacing
window.__VUE_DEVTOOLS_GLOBAL_HOOK__
at build time (nativescript-vue build time) could be the easiest and best approachhttps://github.com/nativescript-vue/nativescript-vue/blob/c91fd9fb0beec94ab5fe055f0b9a3edcd2eaf9e5/build/config.js#L69-L76
damiani commentedon May 28, 2018
I also tried nativescript-socket.io and had the same issue when building iOS. :(
rigor789 commentedon Jun 11, 2018
@damiani Facebook just released Sonar, which might be the right tool for us! https://fbsonar.com/
It supports custom plugins - which seem to be using react, so I wonder if we can drop in a Vue app as a react component in there to run the devtools.
I would wait a bit to see if NativeScript will want to support it officially, because then we would only need to write a plugin for it.
This got me hyped up btw! :)
damiani commentedon Jun 11, 2018
OK that is really cool, especially since it has a network inspector...Vue and Chrome dev tools together in one app would be the holy grail!
msaelices commentedon Jun 20, 2018
A Fbsonar desktop limitation is that runs only on Mac. In comparison, the chrome Vue dev-tools runs wherever Chrome runs (Linux, Windows, and Mac).
rigor789 commentedon Jun 20, 2018
@msaelices Sonar is an electron app, Mac is the officially supported version, but more could come soon. Sure, Chrome devtools would be a good choice, but the chrome debugging protocol is hard to understand / hook into from NativeScript and there is no easy way (not even sure if there is a way) to add vue-devtools to it.
When you open up the Chrome devtools for NativeScript, it runs the devtools "app" inside chrome - you can confirm this by pressing f12, and it will have a Chrome Devtools inspector inspecting the Chrome Devtools inspector (inspector-ception lol).
The plugins you have in your browser do not apply in the NativeScript devtools window, but even if they did it wouldn't be useful because vue-devtools injects a script tag into the page to establish the connection, which doesn't make sense in a NativeScript environment. I've done quite a bit of research about this, and Sonar seems like the better way at this point, since it will allow us to add vue-devtools sooner.
rigor789 commentedon Aug 5, 2018
UPDATE
@znck has been working on making vue-devtools not rely on
window
which prevented us from connecting it to NativeScript in the past, PR here: vuejs/devtools-v6#732With these changes we are now able to connect the standalone VueDevtools to a NativeScript-Vue app, and to make it easier I published this repository as an npm module
nativescript-vue-devtools
. This is not yet usable since the above mentioned PR is not yet merged/released.Once everything is released, I will document how to debug apps... EXCITING TIMES! :)
damiani commentedon Aug 5, 2018
I've been eagerly watching the changes in vuejs/vue-devtools...this is really exciting!
rigor789 commentedon Sep 17, 2018
Landed, and documented: https://nativescript-vue.org/en/docs/getting-started/vue-devtools/
Closing 🎉
msaelices commentedon Sep 17, 2018
@rigor789 Awesome! I think you forgot to document explicitly to install the package with
npm instal nativescript-vue-devtools --save
rigor789 commentedon Sep 17, 2018
@msaelices thanks for the heads up, fixing now!