angular-cli: ng build --prod --aot not working
Bug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.0.0
node: 7.2.1
os: linux x64
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1
Repro steps.
npm install --save-dev @types/googlemaps
and then, change the tsconfig.app.json to:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"types": ["google.maps", "io"]
},
"include": [
"**/*.spec.ts",
"**/*.d.ts"
],
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
if we did not change this file, ng serve fails to provide the google type: Cannot find namespace 'google'
. Without this change, the ng build --prod --aot works.
The log given by the failure.
$ ng build --aot --prod
Hash: 0e5ac752f36ed80df3cd
Time: 3144ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 158 kB {4} [initial] [rendered]
chunk {1} styles.bundle.js, styles.bundle.js.map (styles) 9.77 kB {4} [initial] [rendered]
chunk {2} main.bundle.js, main.bundle.js.map (main) 1.09 kB {3} [initial] [rendered]
chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 806 kB [initial] [rendered]
chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
ERROR in ./src/main.ts
Module not found: Error: Can't res
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/luishmcmoreno/tmp/teste/src'
@ ./src/main.ts 4:0-74
@ multi ./src/main.ts
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 30 (3 by maintainers)
Commits related to this issue
- wip - aot upgrade currently facing issues like https://github.com/angular/angular-cli/issues/5802 cannot find browser-app.module.ngfactory — committed to TrilonIO/aspnetcore-angular-universal by MarkPieszak 7 years ago
- feat(AoT): :sparkles: :sparkles: added initial AoT support any many other things (#151) * wip - aot upgrade currently facing issues like https://github.com/angular/angular-cli/issues/5802 cannot... — committed to TrilonIO/aspnetcore-angular-universal by MarkPieszak 7 years ago
- feat(AoT): :sparkles: :sparkles: added initial AoT support any many other things (#151) * wip - aot upgrade currently facing issues like https://github.com/angular/angular-cli/issues/5802 cannot... — committed to GrandofDeveolop/angular-2-aspnet by GrandofDeveolop 7 years ago
Small Update
I’m still not understanding where is the problem but when I run
it works and the size of the generated code is about 70% smaller than the normal one
Closing as @luishmcmoreno seems to have his problem sorted. Thanks to everyone that helped out!
Yep same here, just upgraded from angular 2 to angular 4 everything works except when I use the --aot command I get this:
ERROR in Child compilation failed:
Juste remove
"types":
entry from tsconfig.Why angular-cli set
"types": []
?@Hosar upgrade to 1.3.1 the latest and it should work fine.
This seems to be happening outside of the CLI as well, with
@ngtools/webpack
in general.