Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

HMR: Hot-updates generated for unchanged file #877

@vakrilov

Description

@vakrilov

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

  1. Create and run with HMR
tns create test-app --tsc
cd test-app
tns run ios --hmr
  1. 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.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 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions