ng build --prod --aot not working
See original GitHub issueBug 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
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:30 (3 by maintainers)
Top Results From Across the Web
ng build --prod --aot not working in Angular 6 - Stack Overflow
I'm trying to deploy the production code in the server using the below command. ng build --prod --aot. I'm getting a dist folder...
Read more >Angular: Writing AoT-friendly applications | by David - Medium
In JiT compilation ( ng build --dev ), the application works fine. However, with AoT compilation ( ng build --prod ), we encounter...
Read more >The Ahead-of-Time (AOT) compiler - Angular - w3resource
The ng build command with the --prod meta-flag (ng build --prod) compiles with AOT by default. Why compile with AOT? Faster rendering.
Read more >ng build - Angular
Option Description Value Type Default Value
‑‑aot Build using Ahead of Time compilation. boolean true
‑‑base‑href Base url for the application being built. string
‑‑delete‑output‑path Delete...
Read more >ng build fails if AOT is enabled (Angular 11) - DayPilot Forums
I'd try reinstalling @angular/cli, there might be a temporary bad dependency somewhere. That is not unusual - just a couple of minutes ago,...
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
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!