nativescript-dev-webpack icon indicating copy to clipboard operation
nativescript-dev-webpack copied to clipboard

[HMR] Changes in plugin do NOT apply in angular projects

Open vchimev opened this issue 6 years ago • 0 comments

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.4
  • Cross-platform modules: 5.4
  • Android Runtime: 5.4
  • iOS Runtime: 5.4
  • Plugin(s): [email protected]
  • Node.js: 12.3.1
  • [x] Please, attach your package.json and webpack.config.js as these configurations are usually critical for investigating issues with webpack - default.

Describe the bug

Changes in plugin do NOT apply in angular projects with HMR.

To Reproduce

git clone https://github.com/NativeScript/nativescript-ui-autocomplete.git && cd ./nativescript-ui-autocomplete/src
npm run postclone && cd ../demo-angular
tns run android|ios (--hmr)

Make a change in nativescript-ui-autocomplete/src/angular/autocomplete-directives.ts. For example, add a console.log() to the constructor. This change is going to be applied.

Make a change in .nativescript-ui-autocomplete/src/ui-autocomplete.common.ts. For example, add a console.log() to the constructor. This change is NOT going to be applied.

Expected behavior

The latest change to be applied.

Sample project

Refer to how To Reproduce.

Additional context

In NativeScript projects with Angular, there is a registry of components: https://github.com/NativeScript/nativescript-angular/blob/7.2.4/nativescript-angular/element-registry.ts

Furthermore, any components in use need to be registered - this is RadAutoCompleteTextView in the particular case: https://github.com/NativeScript/nativescript-ui-autocomplete/blob/v4.0.0/src/angular/autocomplete-directives.ts

As the initial instance of the component is kept in the registry, in order to apply the changes in ui-autocomplete.common.ts, it would be needed to register again the RadAutoCompleteTextView component.

Related to https://github.com/NativeScript/NativeScript/issues/6398.

vchimev avatar May 28 '19 15:05 vchimev