Skip to content

In latest angular-cli: 1.0.0-beta.22 getting exceptions.... #3384

Closed
@born2net

Description

@born2net

In latest angular-cli: 1.0.0-beta.22 getting exceptions....

$ ng serve
** NG Live Development Server is running on http://localhost:4200. **
  0% compilingError encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 41:36 in the original .ts file), resolving symbol providing in C:/msweb/msbarcode/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/msbarcode/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/msbarcode/src/app/app.module.ts
Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 41:36 in the original .ts file), resolving symbol providing in C:/msweb/msbarcode/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/msbarcode/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/msbarcode/src/app/app.module.ts
    at positionalError (C:\msweb\msbarcode\node_modules\@angular\compiler-cli\src\static_reflector.js:595:18)
    at simplifyInContext (C:\msweb\msbarcode\node_modules\@angular\compiler-cli\src\static_reflector.js:473:27)
    at StaticReflector.simplify (C:\msweb\msbarcode\node_modules\@angular\compiler-cli\src\static_reflector.js:478:22)
    at StaticReflector.annotations (C:\msweb\msbarcode\node_modules\@angular\compiler-cli\src\static_reflector.js:60:36)
    at NgModuleResolver.resolve (C:\msweb\msbarcode\node_modules\@angular\compiler\bundles\compiler.umd.js:14261:46)
    at CompileMetadataResolver._loadNgModuleMetadata (C:\msweb\msbarcode\node_modules\@angular\compiler\bundles\compiler.umd.js:14646:45)
    at CompileMetadataResolver.getUnloadedNgModuleMetadata (C:\msweb\msbarcode\node_modules\@angular\compiler\bundles\compiler.umd.js:14636:23)
    at addNgModule (C:\msweb\msbarcode\node_modules\@angular\compiler\bundles\compiler.umd.js:12944:43)
    at C:\msweb\msbarcode\node_modules\@angular\compiler\bundles\compiler.umd.js:12957:16
    at Array.forEach (native)
    at _createNgModules (C:\msweb\msbarcode\node_modules\@angular\compiler\bundles\compiler.umd.js:12956:28)
    at analyzeNgModules (C:\msweb\msbarcode\node_modules\@angular\compiler\bundles\compiler.umd.js:12700:16)
    at analyzeAndValidateNgModules (C:\msweb\msbarcode\node_modules\@angular\compiler\bundles\compiler.umd.js:12704:20)
    at OfflineCompiler.compileModules (C:\msweb\msbarcode\node_modules\@angular\compiler\bundles\compiler.umd.js:12775:20)
    at CodeGenerator.codegen (C:\msweb\msbarcode\node_modules\@angular\compiler-cli\src\codegen.js:58:30)
    at AotPlugin._make (C:\msweb\msbarcode\node_modules\@ngtools\webpack\src\plugin.js:193:43)
    at Compiler.<anonymous> (C:\msweb\msbarcode\node_modules\@ngtools\webpack\src\plugin.js:157:75)
    at Compiler.applyPluginsParallel (C:\msweb\msbarcode\node_modules\tapable\lib\Tapable.js:156:14)
    at Compiler.<anonymous> (C:\msweb\msbarcode\node_modules\webpack\lib\Compiler.js:463:8)
    at Compiler.applyPluginsAsync (C:\msweb\msbarcode\node_modules\tapable\lib\Tapable.js:73:70)
    at Compiler.compile (C:\msweb\msbarcode\node_modules\webpack\lib\Compiler.js:456:7)
    at Watching.<anonymous> (C:\msweb\msbarcode\node_modules\webpack\lib\Compiler.js:46:17)
    at next (C:\msweb\msbarcode\node_modules\tapable\lib\Tapable.js:81:11)
    at Compiler.invalidAsyncPlugin (C:\msweb\msbarcode\node_modules\webpack-dev-middleware\middleware.js:119:3)
    at next (C:\msweb\msbarcode\node_modules\tapable\lib\Tapable.js:83:14)
    at Compiler.<anonymous> (C:\msweb\msbarcode\node_modules\webpack\lib\CachePlugin.js:31:4)
    at Compiler.applyPluginsAsync (C:\msweb\msbarcode\node_modules\tapable\lib\Tapable.js:85:13)
    at Watching._go (C:\msweb\msbarcode\node_modules\webpack\lib\Compiler.js:44:16)
    at Watching.<anonymous> (C:\msweb\msbarcode\node_modules\webpack\lib\Compiler.js:36:8)
    at Compiler.readRecords (C:\msweb\msbarcode\node_modules\webpack\lib\Compiler.js:367:10)
    at new Watching (C:\msweb\msbarcode\node_modules\webpack\lib\Compiler.js:33:16)
    at Compiler.watch (C:\msweb\msbarcode\node_modules\webpack\lib\Compiler.js:204:17)
    at module.exports (C:\msweb\msbarcode\node_modules\webpack-dev-middleware\middleware.js:146:27)
    at new Server (C:\msweb\msbarcode\node_modules\webpack-dev-server\lib\Server.js:43:20)
    at Class.run (C:\msweb\msbarcode\node_modules\angular-cli\tasks\serve-webpack.js:85:22)
    at C:\msweb\msbarcode\node_modules\angular-cli\commands\serve.js:102:26
    at process._tickCallback (internal/process/next_tick.js:103:7)

As you can see I have a simple providing array which causes the problem (works fine in ng cli beta .21)

export var providing = [{
    provide: AppStore, useFactory: (ngRedux: NgRedux<any>, devTools: DevToolsExtension) => {
        const reducers = combineReducers({notify, sample_reducer});
        const middlewareEnhancer = applyMiddleware(<any>thunkMiddleware);
        const applyDevTools = () => devTools.isEnabled() ? devTools.enhancer : f => f;
        const enhancers: any = compose(middlewareEnhancer, applyDevTools);
        const store = createStore(reducers, enhancers);
        ngRedux.provideStore(store);
        return new AppStore(store);
    }, deps: [NgRedux, DevToolsExtension]
}, {
    provide: "OFFLINE_ENV",
    useValue: false
}, {
    provide: SampleActions,
    useClass: SampleActions
}];

@NgModule({
    declarations: [
        AppComponent,
        // MyComp
    ],
    imports: [
        BrowserModule,
        FormsModule,
        HttpModule,
        // MsLibModule.forRoot(),
        // NgReduxModule.forRoot(), //toggle
        MaterialModule.forRoot()
    ],
    providers: [providing],
    bootstrap: [AppComponent]
})

so ng cli is not happy about the fact I am running a factory with functions (which is the proper way of setting up Redux). If I remove the entire providing function, .22 passes the ng serve, but again, have to do it in order to bootstrap Redux.

You can take a look at the very small project at:
https://github.com/born2net/msbarcode/tree/hmr

will be happy to help test as I'd like to get hmr running which requires .22.

regards,

Sean

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions