{"id":935,"date":"2019-05-24T07:03:52","date_gmt":"2019-05-24T07:03:52","guid":{"rendered":"http:\/\/fluentreports.com\/blog\/?p=935"},"modified":"2019-07-11T01:37:03","modified_gmt":"2019-07-11T01:37:03","slug":"nativescript-5-x-and-hmr-issues","status":"publish","type":"post","link":"http:\/\/fluentreports.com\/blog\/?p=935","title":{"rendered":"NativeScript 5.x and HMR Issues"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">If you are one of the lucky people who are reading this blog article, because your app used to work!    After upgrading to the latest NativeScript and enabling the new Workflow your app is now broken...    <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Well I have some good news...   It is easy to get back to a working state.<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Here is how you can revert back to using the Legacy Workflow..<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First thing, you need to open the <code>nsconfig.json<\/code> file in the root of your project.  This file is where this key parameter is kept.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"324\" src=\"http:\/\/fluentreports.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png\" alt=\"\" class=\"wp-image-936\" srcset=\"http:\/\/fluentreports.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png 735w, http:\/\/fluentreports.com\/blog\/wp-content\/uploads\/2019\/05\/image-1-300x132.png 300w, http:\/\/fluentreports.com\/blog\/wp-content\/uploads\/2019\/05\/image-1-624x275.png 624w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Inside the <code>nsconfig.json<\/code> file you will see <code>&quot;useLegacyWorkflow&quot;: true<\/code> change this to false and save the file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then from the CLI; do a<br>- <code>tns platform clean android<\/code>     (if using Android)<br>- <code>tns platform clean ios<\/code>    (if using iOS)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then you can do a <code>tns run android<\/code> or <code>tns run ios<\/code> and be back working.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Please note; <strong>DO NOT USE<\/strong>  <code>--bundle<\/code> or <code>--hmr<\/code> flags; as this will re-enable HMR and the only reason you are changing this flag is because HMR is already not working for you...  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I would recommend you submit a bug report to the <a href=\"https:\/\/github.com\/nativescript\/nativescript-dev-webpack\">nativescript-dev-webpack<\/a> github repo about your issue; so that it can be tracked.   Version 6.0 of NativeScript is supposedly going to disable the Legacy Workflow mode; so it is critical they get all the data they can on what issues you have seen so they can iron them all out...<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common HMR issues with fixes:<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Your page\/css\/xml\/html isn't changing on the device.   <ul><li>Make sure the name of the files end with \"<strong>-page<\/strong>\".   So \"main<strong>-page<\/strong>.xml\" or \"cool<strong>-page<\/strong>.css\"<\/li><\/ul><\/li><li>Your extra files (like sqlite databases) aren't being synced to the device.   <ul><li>Edit your webpack.config.js file, and add them to the copy step so that they are bundled up.<\/li><\/ul><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Some common broken NativeScript-Core HMR  issues:<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Pure JavaScript apps (i.e. not TypeScript) do not function properly on the second screen or on the first screen if using a SideDrawer as the root view.   Click\/Tap\/Event handlers are not assigned properly.<\/li><li>Width\/Height Specific files are unused  (i.e. main-page.HW600.xml doesn't work; only main-page.xml is picked up.)<\/li><li>Shared NativeScript XML files do not link up to proper event handlers.  (Similar to first issue; but a different aspect)<\/li><li>Some CSS files do not seem to be tracked properly.<br><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are one of the lucky people who are reading this blog article, because your app used to work! After upgrading to the latest NativeScript and enabling the new Workflow your app is now broken... Well I have some good news... It is easy to get back to a working state. Here is how&hellip; <a class=\"more-link\" href=\"http:\/\/fluentreports.com\/blog\/?p=935\">Continue reading <span class=\"screen-reader-text\">NativeScript 5.x and HMR Issues<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[15,39],"tags":[135,16,134],"class_list":["post-935","post","type-post","status-publish","format-standard","hentry","category-nativescript","category-tips","tag-legacy","tag-nativescript","tag-workflow","entry"],"_links":{"self":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=935"}],"version-history":[{"count":3,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/935\/revisions"}],"predecessor-version":[{"id":1001,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/935\/revisions\/1001"}],"wp:attachment":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=935"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}