ERROR in Error: Error encountered resolving symbol values statically. Calling function 'TestModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function
See original GitHub issuetest.module.ts
import { NgModule, ModuleWithProviders } from '@angular/core';
import { TestService } from './test.service';
@NgModule({
imports: [],
declarations: [],
exports: [],
entryComponents: []
})
export class TestModule {
static forRoot (): ModuleWithProviders {
return {
ngModule: TestModule,
providers: [TestService]
};
}
}
test.service.ts
import { Injectable } from '@angular/core';
@Injectable()
export class TestService {
constructor () {
}
dialog () {
return {
action: 'test'
};
}
}
tsconfig.json
{
"compilerOptions": {
"noImplicitAny": true,
"module": "commonjs",
"target": "ES5",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"declaration": true,
"moduleResolution": "node",
"noUnusedLocals": true,
"removeComments": false,
"skipLibCheck": true,
"outDir": "fe-test/",
"typeRoots": [
"../../../node_modules/@types"
],
"lib": ["es2015"]
},
"files": [ "index.ts" ],
"exclude": [
"../../../node_modules"
]
}
Usage:
cd test && tsc
import { TestModule } from './test/fe-test';
import { AppComponent } from './app.component';
import { appRoutes } from './app.routes';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule.withServerTransition({ appId: 'ang5-seo' }),
BrowserAnimationsModule,
FormsModule,
ReactiveFormsModule,
RouterModule.forRoot(appRoutes),
TestModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
Development environment:
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/platform-server": "^5.0.0",
"@angular/router": "^5.0.0",
"@nguniversal/express-engine": "^5.0.0-beta.5",
"@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5",
run
ng serve --prod
Throws Error:
ERROR in Error: Error encountered resolving symbol values statically. Calling function 'TestModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /Users/wangchengjun/www/yooli/mock/angular5-seo-demo/src/app/app.module.ts, resolving symbol AppModule in /Users/wangchengjun/www/yooli/mock/angular5-seo-demo/src/app/app.module.ts
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
ERROR in Error encountered resolving symbol values ...
Calling function 'PerfectScrollbarModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function ...
Read more >ERROR in Error encountered resolving symbol values ...
ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda ...
Read more >Error encountered resolving symbol values statically - O'Reilly
Calling function 'ModalDialogParams', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, ...
Read more >angular-ui/ui-router - Gitter
client?93b6:101 Error encountered resolving symbol values statically. Calling function 'UIRouterModule', function calls are not supported. Consider ...
Read more >The Racket Guide - Northwestern University PLT
This guide is intended for programmers who are new to Racket or new to some part of. Racket. It assumes programming experience, so...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Referencing your src directly rather than the compiled output makes it work meaning you likely have an issue with your bundling config. I don’t see the issue with Angular here
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.