ionic2-mask-directive
ionic2-mask-directive copied to clipboard
Cannot redeclare block-scoped variable 'ngDevMode' - Back with Angular 5.2.3
@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'.
@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.
same here @tiaguinho
@tiaguinho Need a solution that prevents future upgrading from colliding.
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 any luck?
@tiaguinho angular just updated to 5.2.4 - still an issue with core. Have to stay on 5.2.2 to avoid the error.
@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
@tiaguinho have you had a chance to update it?
@tiaguinho thanks for your great work!
@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.
@tiaguinho can you release a version with the dependencies at 5.2.5 until you complete the fix.
@tiaguinho i was wondering if you had any updates regarding this? Thanks
This week was crazy, so I'll try to finish this on the weekend. Sorry for the delay.
no problem thanks for your help
@tiaguinho any progress?
also interested @tiaguinho
@tiaguinho still an issue with core 5.2.6
@tiaguinho also with 6.0.0-beta.5 (2018-02-22) core it breaks.
@tiaguinho @TalissonJunior any updates on fixing this or at least updating it to handle angular 5.2.7 for the time being?
@tiaguinho @TalissonJunior Still an issue with 5.2.8 as expected. Any updates?
@tiaguinho also would be interested in this.
@tiaguinho @TalissonJunior Any update?
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.
I don't know if I would say it's an angular issue perse. I see that they mention a couple solutions:
- https://github.com/angular/angular/issues/21925
- 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."