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 has been 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.
The text was updated successfully, but these errors were encountered:
By using transpileOnly: false, the enums are inlined compile time. In other words, color: Colors.red is directly replaced with color: "red" in your JavaScript code and you don't need the Colors enum available and exported in the JavaScript modules.
However, transpileOnly: true is not making impossible to use the const enums, it just does not inline them. In other words, you have to export the enums in order to make them available at runtime because in your JavaScript code you will still have color: Colors.red and the Colors enum should be available and exported in the JavaScript modules.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Environment
Provide version numbers for the following components (information can be retrieved by running
tns info
in your project folder or by inspecting thepackage.json
of the project):5.3.4
5.3.1
5.3.1
5.3.1
10.15.1
~0.21.0
Describe the bug
HMR generates hot-updates for files that are not changed.
To Reproduce
main-view-modes.ts
file multiple times to generate hot updates.Explore the generated hot-updates in
platforms/ios/testapp/app/
( thebundle.XXXX.hot-update.js
files). All of them (except the first update) contain bothmain-view-modes.ts
and./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 insidemain-page.ts
is not possible. Because themain-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 thets-loader
resolves the issue.The text was updated successfully, but these errors were encountered: