You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
CLI: 5.3.4
Cross-platform modules: 5.3.1
Android Runtime: 5.3.1
iOS Runtime:5.3.1
Node.js: 10.15.1
nativescript-dev-webpack: ~0.21.0
Describe the bug
HMR generates hot-updates for files that are not changed.
To Reproduce
Create and run with HMR
tns create test-app --tsc
cd test-app
tns run ios --hmr
Change and save main-view-modes.ts file multiple times to generate hot updates.
Explore the generated hot-updates in platforms/ios/testapp/app/( the bundle.XXXX.hot-update.js files). All of them (except the first update) contain both main-view-modes.tsand ./main-page.ts.
The ./main-page.ts file wasn't changed, so it should not be re-generated and sent as a hot-update.
Expected behavior
Changes should be generated only for the changed files.
Why This Is Important
In the above example trying to use module.hot.accept(["./main-view-model"], () => { ... }) and handle view-model changes inside main-page.ts is not possible. Because the main-page.ts is also included in the hot-update it's changes bubble up and cannot be handled.
Possible Cause and Solution
According to ts-loader docs the transpileOnly flag should be enabled when using the loader with HMR.
Indeed setting transpileOnly: true in the ts-loader resolves the issue.