@ngtools/webpack - Error encountered resolving symbol values statically
Versions.
Repro steps.
Not really repro steps, but the not-changed webpack config used to work with [email protected] and @ngtools/[email protected], since upgrading I get the error described below and I have no idea what to do about it.
The log given by the failure.
ERROR in 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 AnimationDriver in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/testing/browser.d.ts
ERROR in ./src/bootstrap.ts
Module not found: Error: Can't resolve './../$$_gendir/src/app/main.module.ngfactory' in '/Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/src'
@ ./src/bootstrap.ts 3:0-83
ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/$$_gendir' in '/Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/core/src/linker'
@ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
@ ./~/@angular/core/src/linker.js
@ ./~/@angular/core/src/core.js
@ ./~/@angular/core/index.js
@ ./src/bootstrap.ts
My last mentioned error went away (and AoT compilation is now working again for me) after specifying 'mainPath' in my AoTPlugin.
About my problem (Could not resolve "app/+home/home.module" from "/src/app/app.module.ts"). I changed the routing
FROM: export const routes: Routes = [ { path: '', component: MainLayoutComponent, children: [ { path:'', children: [ { path: 'home', loadChildren: 'app/+home/home.module#HomeModule' }] } ] } ];
TO:
export const routes: Routes = [ { path: '', component: MainLayoutComponent, children: [ { path:'', children: [ { path: 'home', loadChildren: './+home/home.module#HomeModule' }] } ] } ];
This Angular-cli is completely not ready for working with it...
I just ran into this problem, installing all the latest dependencies, and trying to run ng serve --prod --aot today. This should be reopened.
agreed...
Same error here:
ERROR in this.host.isSourceFile is not a function
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/var/node/mauron85-background-geolocation-example-website/src'
@ ./src/main.ts 5:29-76
@ multi main
ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/var/node/mauron85-background-geolocation-example-website/src/$$_gendir' in '/var/node/mauron85-background-geolocation-example-website/node_modules/@angular/core/src/linker'
@ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
@ ./~/@angular/core/src/linker.js
@ ./~/@angular/core/src/core.js
@ ./~/@angular/core/index.js
@ ./src/main.ts
@ multi main
webpack: bundle is now VALID.
any solution for this issue. I have same issue. here is how i am using AOTPlugin
{
test: /\.ts$/, loaders: ['@ngtools/webpack']
}
new AOTPlugin({
tsConfigPath: './tsconfig.json',
entryModule: 'src/app/app.module#AppModule'
})
@ajantsch I'm experiencing the same error you had:
ERROR in Could not resolve "./src/app/app.module" from "./src/app/app.module".
I added the mainPath option as you mentioned, but the error remains.
Plugin config:
new ngToolsWebpack.AotPlugin({
tsConfigPath: './tsconfig.aot.json',
entryModule: './src/app/app.module#AppModule',
mainPath: './src/app/main.ts'
})
Versions:
Any ideas as to how to solve this issue?
@bellizio unfortunately not, the only thing I do differently is that I use a helper function that creates the path-string.
var root = function (args) {
args = Array.prototype.slice.call(arguments, 0);
return path.join.apply(path, [__dirname].concat(args));
};
new AotPlugin({
tsConfigPath: root('tsconfig.aot.json'),
entryModule: root('src', 'app', 'main.module#MainModule'),
mainPath: root('src', 'bootstrap.ts')
}),
@ajantsch that did the trick. I'm using the same helper method elsewhere in my webpack config but completely overlooked adding it to those paths in the plugin's options.
thanks!
@hansl here's the repo with this bug, https://github.com/serhiisol/ng2-webpack.
It generates error like this:

I'm still getting this issue when running ng build --aot --prod
Using angular-cli version beta25.5 (Recent upgrade, removed node_modules, ran ng init).
[...]
95% emitting
Hash: bb7e79302cc7a41dc740
Time: 20780ms
chunk {0} main.1c5fa69e760392c7ce83.bundle.js (main) 1.14 kB {2} [initial] [rendered]
chunk {1} styles.9c92e557c163cbba0a69.bundle.css (styles) 2.37 kB {3} [initial] [rendered]
chunk {2} vendor.aad8bb621ae4ff563de3.bundle.js (vendor) 1.06 MB [initial] [rendered]
chunk {3} inline.1c680af8a30b36bb0fc2.bundle.js (inline) 0 bytes [entry] [rendered]
ERROR in Can't resolve all parameters for FirebaseSdkAuthBackend in /Users/asher/Sites/ds-front/node_modules/angularfire2/auth/firebase_sdk_auth_backend.d.ts: ([object Object], ?).
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/Users/asher/Sites/ds-front/src'
@ ./src/main.ts 4:0-74
@ multi main
ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/Users/asher/Sites/ds-front/src/$$_gendir' in '/Users/asher/Sites/ds-front/node_modules/@angular/core/src/linker'
@ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
@ ./~/@angular/core/src/linker.js
@ ./~/@angular/core/src/core.js
@ ./~/@angular/core/index.js
@ ./src/main.ts
@ multi main
Getting this error with beta26 as well. Hope someone can help?
same here after [email protected] update @angular/*/2.4.4
Same here, with [email protected]/angular 2.4.4. Brand new app, getting this error while trying to use ng2-restangular 0.1.27
Same issue here when importing an npm linked module. Using "angular-cli": "1.0.0-beta.24", @angular/*/2.4.4
Same issue. Can this at least be dropped to a Warning so that my build process can continue? Everything appears to work fine despite this error.
Same here. Any updates?

I am having this issue too. What is the fix?
Why is this issue marked as close? the error message still appears after upgrading to beta 30 with AOT build.