ionic2-mask-directive icon indicating copy to clipboard operation
ionic2-mask-directive copied to clipboard

Cannot redeclare block-scoped variable 'ngDevMode' - Back with Angular 5.2.3

Open erickbrenesLT opened this issue 7 years ago • 24 comments

@tiaguinho Getting this error. ionic serve fails in Angular 5.2.3, Ionic 4.5.3, Ionic2-Mask 1.0.8 typescript: node_modules//src/render3/ng_dev_mode.d.ts, line: 9 Cannot redeclare block-scoped variable 'ngDevMode'.

typescript: ...es/ionic2-mask-directive/node_modules//src/render3/ng_dev_mode.d.ts, line: 9 Cannot redeclare block-scoped variable 'ngDevMode'.

erickbrenesLT avatar Feb 01 '18 16:02 erickbrenesLT

@tiaguinho this happens with angular core. If I downgrade just angular core to 5.2.2 - it works. The ngDevMode is seeing a global declaration of itself when it comes to project dependencies and this lib's dependencies and when you have two different angular versions 5.2.2 vs 5.2.3.

erickbrenesLT avatar Feb 05 '18 15:02 erickbrenesLT

same here @tiaguinho

okonon avatar Feb 05 '18 15:02 okonon

@tiaguinho Need a solution that prevents future upgrading from colliding.

erickbrenesLT avatar Feb 05 '18 15:02 erickbrenesLT

I'm trying to fix this problem. I'm changing the dependencies and transform the directive in a module. I'll try to publish a new version until tomorrow.

tiaguinho avatar Feb 05 '18 19:02 tiaguinho

@tiaguinho any luck?

erickbrenesLT avatar Feb 06 '18 15:02 erickbrenesLT

@tiaguinho angular just updated to 5.2.4 - still an issue with core. Have to stay on 5.2.2 to avoid the error.

erickbrenesLT avatar Feb 08 '18 15:02 erickbrenesLT

@tiaguinho getting a typescript error with AOT again - not sure if it's related. Here is info on it maybe - https://github.com/angular/angular/issues/15767

typescript error Error during template compile of 'Ionic2MaskDirective' Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'Directive' 'Directive' calls 'ɵmakeDecorator'.

[10:21:47] ionic-app-script task: "build" [10:21:47] Error: The Angular AoT build failed. See the issues above Error: The Angular AoT build failed. See the issues above at /Users/erickbrenes/Sites/site/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:237:55 at step (/Users/erickbrenes/Sites/site/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:32:23) at Object.next (/Users/erickbrenes/Sites/site/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:13:53) at fulfilled (/Users/erickbrenes/Sites/site/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:4:58) at

erickbrenesLT avatar Feb 08 '18 16:02 erickbrenesLT

@tiaguinho have you had a chance to update it?

erickbrenesLT avatar Feb 12 '18 16:02 erickbrenesLT

@tiaguinho thanks for your great work!

okonon avatar Feb 12 '18 16:02 okonon

@tiaguinho upgraded to Angular 5.2.5 core and it's still an issue. Any progress with updating the app? At the very least can you release a version with the dependencies at 5.2.5 until you complete the fix.

erickbrenesLT avatar Feb 14 '18 15:02 erickbrenesLT

@tiaguinho can you release a version with the dependencies at 5.2.5 until you complete the fix.

erickbrenesLT avatar Feb 15 '18 19:02 erickbrenesLT

@tiaguinho i was wondering if you had any updates regarding this? Thanks

okonon avatar Feb 15 '18 19:02 okonon

This week was crazy, so I'll try to finish this on the weekend. Sorry for the delay.

tiaguinho avatar Feb 15 '18 21:02 tiaguinho

no problem thanks for your help

okonon avatar Feb 15 '18 21:02 okonon

@tiaguinho any progress?

erickbrenesLT avatar Feb 20 '18 16:02 erickbrenesLT

also interested @tiaguinho

okonon avatar Feb 20 '18 16:02 okonon

@tiaguinho still an issue with core 5.2.6

erickbrenesLT avatar Feb 22 '18 15:02 erickbrenesLT

@tiaguinho also with 6.0.0-beta.5 (2018-02-22) core it breaks.

erickbrenesLT avatar Feb 22 '18 15:02 erickbrenesLT

@tiaguinho @TalissonJunior any updates on fixing this or at least updating it to handle angular 5.2.7 for the time being?

erickbrenesLT avatar Mar 06 '18 15:03 erickbrenesLT

@tiaguinho @TalissonJunior Still an issue with 5.2.8 as expected. Any updates?

erickbrenesLT avatar Mar 13 '18 14:03 erickbrenesLT

@tiaguinho also would be interested in this.

agnosticdev avatar Mar 14 '18 14:03 agnosticdev

@tiaguinho @TalissonJunior Any update?

erickbrenesLT avatar Apr 05 '18 14:04 erickbrenesLT

It's not a issue from this project. It's a angular issue.

angular/angular#21670

It's a conflict, because this repo and the ionic uses the angular/core, and same constant are declareted when typescript build the node_modules folder.

adrianowead avatar Apr 19 '18 20:04 adrianowead

I don't know if I would say it's an angular issue perse. I see that they mention a couple solutions:

  1. https://github.com/angular/angular/issues/21925
  2. https://github.com/angular/angular/issues/21670#issuecomment-370274821

Quote form 1. That might help. "The problem is fundamentally here,

"paths": { "Utils/": ["../module/src/utils/"] } This causes TypeScript to bring in both the @angular/core from ../modules/node_modules/@angular/core as well as the @angular/core from ./node_modules/@angular/core. This has never been supported and errors produced in this configuration are not considered regressions as the scenario is not support, it just happened not to break for you until 5.2. There are several cases where this would have broken your code earlier, you just didn't hit them. To state this more clearly, we don't support having two different versions of angular definitions in the same compilation.

The simple way around this is to have module and app share the same copy of angular instead of having there own. In other words, move the package.json up one directory.

If you require to have a separate compilation then I recommend using something like ng-packgr to help build the module directory as a package. This package can then be installed into the node_modules of app.

We are working to improve the ergonomics of libraries and is one of our primary focuses for this release cycle. For now, however, you need to ensure that only one copy of angular is found by the compiler or separately compile the modules using ng-packgr."

erickbrenesLT avatar Apr 20 '18 15:04 erickbrenesLT