Angular2: ERROR in detected error.

I am using angular / cli 1.3.2 and Angular 4.4.0. When I use the npm module angular-split@0.2.2 , during compilation I met

Error in error. Function calls are not supported. Consider replacing a function or lambda with a link to the exported function (position 194: 50 to the source .ts file), allowing the NgModule character in the project path / node_modules / angular -split/node_modules/@angular/core/core.d.ts, allowing AngularSplitModule symbol in the Project Path / node_modules / angular -Split / DIST / angularSplit.module.d.ts, allowing the AngularSplitModule symbol in the Project Path / node_modules / angular -split / DIST / angularSplit.module.d.ts

Here in the angularSplit.module.d.ts file there is only one line of code:

export declare class AngularSplitModule {}

However, this error can be "resolved" by saving any file and starting recompilation (strange).

Then, when I open localhost:4200 in the browser, I will see another error:

compiler.es5.js:1694 Uncaught Error: Unexpected value 'AngularSplitModule' imported by the module 'AppModule'. Please add a @NgModule annotation.

From github and stackoverflow, I found some similar problems, but no one could explain the reason.

This happened after I updated node / angular / angular-cli, but after I rolled back, it still didn't work.

Does anyone know why this happened?

+5
source share
1 answer

Well, after several hours of reading, I found one useful solution here https://github.com/angular/angular-cli/issues/3854#issuecomment-274344771

to indicate add paths: { "@angular/*": ["../node_modules/@angular/*"] } to the tsconfig.json file, the "compilerOptions" option

It solves my problem, but still want to know why.

+6
source

Source: https://habr.com/ru/post/1271492/


All Articles