问题
I have angular 2 nativescript project and I use
tns livesync android --watch
or tns run android
to see changes on both real device and emulator. It usually works fine but at some point it starts building and syncing old code and throws JS errors based on that code.
It's usually solvable by reseting the whole project (remove platforms, node-modules, hooks) and tns install
everything back.
When I add new node modules and/or new custom components, I usually kill the lifesync and do the tns build android
.
Regardless of this lifewatch serves old html and old js (transpiled from ts).
When I saw the output in the terminal I copied out the elements that caused an error and searched in the whole project for these elements. However they are nowhere to be found. First I thought they were still inside platforms
folder, but no, so they must be cached somewhere. Has anyone noticed this as well? How to fix this / work around this ?
I am using Webstorm - tried invalidating cache and restart. Didn't help. Decided to switch over to Visual Studio Code, but it is doing the exact same thing. I have even deleted .gradle folder in order to delete cached files. Didn't help.
回答1:
It seems this is fixed in next release (unfortunately not the current 2.2). Read up on their github . It was indeed the CLI syncing wrong files.
来源:https://stackoverflow.com/questions/38853359/nativescript-builds-old-code