AOT seems to be enabled by default in beta.22 ?
Please provide us with the following information:
OS?
Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
El Capitan
Versions.
Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here:
angular-cli: 1.0.0-beta.22 node: 6.6.0 os: darwin x64
Repro steps.
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
run ng serve
The log given by the failure.
Normally this include a stack trace and some more information.
10% building modules 2/2 modules 0 active(node:14509) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): 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, resolving symbol AppModule in /Users/ritz078/projects/housing-assist/src/app/app.module.ts, resolving symbol AppModule in /Users/ritz078/projects/housing-assist/src/app/a 20% building modules 86/86 modules
Mention any other details that might be useful.
Thanks! We'll be in touch soon.
@aaronleeucla Are those stats pre-gzipped?
It is expected to go up in size (since AoT is actually compiling the HTML templates into JavaScript code, which is bigger), but the gzipped version of the files should be smaller, since there's a lot of repetition of the code.
I'm currently fixing #2799, will come back later this week and definitely be in the next release.
@hansl No, those stats are production gzipped. Main/vendor decrease in size, but chunks definitely increase. For my current app at no network throttling, AoT does improve loading and rendering time. But at scale, with an app with a large set of eager and/or lazy loaded HTML, the gains of AoT could very well be offset by the increased loading time of pre-compiled HTML, especially over slow networks.
@montella1507 to fix, in general, you need to have declarations: false set in the tsconfig. @hansl unless you already know why it seems to be ignoring the tsconfig settings, I'll open a separate issue and try and track it down tonight.
If I have to use angular 2.3.0 --> angular-cl 1.0.0-beta.21 and awesome-typescript-loader 3.0.0-beta.10 combinations works for me.
{
"name": "test",
"version": "0.1.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.3.0",
"@angular/compiler": "2.3.0",
"@angular/core": "2.3.0",
"@angular/forms": "2.3.0",
"@angular/http": "2.3.0",
"@angular/platform-browser": "2.3.0",
"@angular/platform-browser-dynamic": "2.3.0",
"@angular/router": "3.3.0",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.14",
"@ngrx/core": "1.2.0",
"@ngrx/db": "2.0.1",
"@ngrx/effects": "2.0.0",
"@ngrx/router-store": "1.2.5",
"@ngrx/store": "2.2.1",
"@ngrx/store-devtools": "3.2.2",
"angular-in-memory-web-api": "0.1.17",
"angular2-jwt": "0.1.26",
"angular2-moment": "1.0.0",
"bootstrap": "4.0.0-alpha.5",
"core-js": "2.4.1",
"font-awesome": "4.7.0",
"ng2-toasty": "2.1.0",
"rxjs": "5.0.0-rc.5",
"ts-helpers": "1.1.2",
"web3": "0.17.0-beta",
"zone.js": "0.7.2"
},
"devDependencies": {
"@angular/compiler-cli": "2.3.0",
"@types/bignumber.js": "co-mmons/types-bignumber.js",
"@types/jasmine": "2.5.38",
"@types/node": "6.0.51",
"@types/web3": "cashila/web3-typed",
"angular-cli": "1.0.0-beta.21",
"codelyzer": "2.0.0-beta.3",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.7.0",
"karma": "1.3.0",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-remap-istanbul": "0.2.1",
"protractor": "4.0.13",
"ts-node": "1.7.2",
"tslint": "4.0.2",
"typescript": "2.1.4",
"webdriver-manager": "10.2.10"
},
"optionalDependencies": {
"awesome-typescript-loader": "3.0.0-beta.10"
}
}
is the reason build .22 is so bad because it uses AOT?
I did try --aot false and still it hangs at 20% when running ng serve
hope we can get a new build soon
regards
Try 'ng build' to see some details why it's hanging. But disabling --aot didn't work for me
had same results with ng build
@born2net what were the results of your build? It still hung or...
root@DESKTOP-VEUHFOL /cygdrive/c/msweb/studioDashboard
$ ng build
10% building modules 3/3 modules 0 activeError encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'providing'. Consider exporting the symbol (position 135:5 in the original .ts file), resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts
Error: Error encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'providing'. Consider exporting the symbol (position 135:5 in the original .ts file), resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts
at positionalError (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\static_reflector.js:595:18)
at simplifyInContext (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\static_reflector.js:473:27)
at StaticReflector.simplify (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\static_reflector.js:478:22)
at StaticReflector.annotations (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\static_reflector.js:60:36)
at AotPlugin.getNgModuleMetadata (C:\msweb\studioDashboard\node_modules\@ngtools\webpack\src\plugin.js:330:41)
at AotPlugin._processNgModule (C:\msweb\studioDashboard\node_modules\@ngtools\webpack\src\plugin.js:271:42)
at C:\msweb\studioDashboard\node_modules\@ngtools\webpack\src\plugin.js:242:39
at process._tickCallback (internal/process/next_tick.js:103:7)
root@DESKTOP-VEUHFOL /cygdrive/c/msweb/studioDashboard
$
let me remind that all is perfect in .21 and I wish to continue and run in JIT, as I have no interest in AOT at this point,
and same output on: ng build --aot false
regards
@xmlking When I update to 2.3.0 and "awesome-typescript-loader": "3.0.0-beta.10"
https://github.com/angular/angular-cli/issues/3529
for reference, error is coming from: https://github.com/born2net/studioDashboard/blob/master/src/app/app.module.ts
@born2net does the error go away with ng build --aot=true ? Also, have you tried exporting those vars and seeing if it can build?
@born2net not relevant to this issue, but you need to export var providing. You simply declare it right now.
I can only assume a lot more people are going to face issues as they will start moving to .22. So I went ahead and changed it to '''export var providing = ...''' I also changed my providing to lambda from arrow function
export var providing = [CommBroker, AUTH_PROVIDERS,
{
provide: AppStore, useFactory: function() {
const reducers = combineReducers({
notify,
appdb,
business,
stations,
reseller,
adnet,
orders
});
const middlewareEnhancer = applyMiddleware(<any>thunkMiddleware);
const isDebug = window['devToolsExtension']
// const applyDevTools = () => isDebug ? window['devToolsExtension']() : f => f;
// const enhancers: any = compose(middlewareEnhancer, applyDevTools());
const enhancers: any = compose(middlewareEnhancer);
const store = createStore(reducers, enhancers);
return new AppStore(store);
}, deps: []
},
...
and here are the issues now. tried both aot true / false
root@DESKTOP-VEUHFOL /cygdrive/c/msweb/studioDashboard
$ ng build --aot false
10% building modules 3/3 modules 0 activeError encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/studioDashboard/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, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts
at simplifyInContext (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\static_reflector.js:475:23)
at StaticReflector.simplify (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\static_reflector.js:478:22)
at StaticReflector.annotations (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\static_reflector.js:60:36)
at AotPlugin.getNgModuleMetadata (C:\msweb\studioDashboard\node_modules\@ngtools\webpack\src\plugin.js:330:41)
at AotPlugin._processNgModule (C:\msweb\studioDashboard\node_modules\@ngtools\webpack\src\plugin.js:271:42)
at C:\msweb\studioDashboard\node_modules\@ngtools\webpack\src\plugin.js:242:39
at process._tickCallback (internal/process/next_tick.js:103:7)
root@DESKTOP-VEUHFOL /cygdrive/c/msweb/studioDashboard
$
root@DESKTOP-VEUHFOL /cygdrive/c/msweb/studioDashboard
$
root@DESKTOP-VEUHFOL /cygdrive/c/msweb/studioDashboard
$
root@DESKTOP-VEUHFOL /cygdrive/c/msweb/studioDashboard
$ ng build --aot true
10% building modules 3/3 modules 0 activecan't resolve module C:/msweb/studioDashboard/src/appdb/NotifyReducer.ts from C:/msweb/studioDashboard/src/appdb/NotifyReducer.ts
can't find symbol notify exported from module C:/msweb/studioDashboard/src/appdb/NotifyReducer.ts
Error: can't find symbol notify exported from module C:/msweb/studioDashboard/src/appdb/NotifyReducer.ts
at ReflectorHost.findDeclaration (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\reflector_host.js:173:23)
at C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\codegen.js:137:46
at Array.forEach (native)
at extractProgramSymbols (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\codegen.js:120:10)
at CodeGenerator.codegen (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\codegen.js:57:29)
at C:\msweb\studioDashboard\node_modules\@ngtools\webpack\src\plugin.js:210:73
at process._tickCallback (internal/process/next_tick.js:103:7)
root@DESKTOP-VEUHFOL /cygdrive/c/msweb/studioDashboard
$
I am not even thinking AOT at this point as I am sure many things I do are not going to be compatible with AOT, for example I used private in components for members which are accessed from the template, I know these need to be public, as one example.
So really I just want to get JIT working with .22 so I can finally use --hmr which I have been waiting for, for sooo long...
but no go.
@hansl if you have a chance it would be awesome if you could use my project as a test bed for .22 (should only take few minutes to install)
git clone https://github.com/born2net/studioDashboard.git
studioDashboard
npm i
ng build --aot false
and if you can get it working with .22, I'd buy u a beer :) (works great in .21 so I can't imagine it would be so difficult in .22)
tx as always,
Sean.
@born2net extract your factory into an exported function. e.g. something like
export function appStoreFactory() {
const reducers = etc;
}
provide: AppStore, useFactory: appStoreFactory
tx for the reply so went ahead and converted to:
export function appStoreFactory() {
const reducers = combineReducers({
notify,
appdb,
business,
stations,
reseller,
adnet,
orders
});
const middlewareEnhancer = applyMiddleware(<any>thunkMiddleware);
// const isDebug = window['devToolsExtension']
// const applyDevTools = () => isDebug ? window['devToolsExtension']() : f => f;
// const enhancers: any = compose(middlewareEnhancer, applyDevTools());
const enhancers: any = compose(middlewareEnhancer);
const store = createStore(reducers, enhancers);
return new AppStore(store);
}
issue persists:
$ ng build
10% building modules 3/3 modules 0 activeError encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/studioDashboard/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, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts
at simplifyInContext (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\static_reflector.js:475:23)
at StaticReflector.simplify (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\static_reflector.js:478:22)
at StaticReflector.annotations (C:\msweb\studioDashboard\node_modules\@angular\compiler-cli\src\static_reflector.js:60:36)
at AotPlugin.getNgModuleMetadata (C:\msweb\studioDashboard\node_modules\@ngtools\webpack\src\plugin.js:330:41)
at AotPlugin._processNgModule (C:\msweb\studioDashboard\node_modules\@ngtools\webpack\src\plugin.js:271:42)
at C:\msweb\studioDashboard\node_modules\@ngtools\webpack\src\plugin.js:242:39
at process._tickCallback (internal/process/next_tick.js:103:7)
Getting the same kind of stuff here. There should really be a way to disable the AoT plugin and just use awesome-typescript-loader or ts-loader.
I have found what causes this problem in my case:
If I understand correctly, they filter out the character ! from path, but ! is legal character in Windows path.
https://github.com/angular/angular-cli/issues/3529#issuecomment-266737336
I am also facing similar issues, How can I downgrade to the angular-cli.