Angular-cli: CLI 1.6.4 runtime error on bootstrap in prod bundle

Created on 12 Jan 2018  路  11Comments  路  Source: angular/angular-cli

Versions

Angular CLI: 1.6.4
Node: 8.9.0
OS: win32 x64
Angular: 5.2.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.4
@angular-devkit/build-optimizer: 0.0.37
@angular-devkit/core: 0.0.24
@angular-devkit/schematics: 0.0.45
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.4
@schematics/angular: 0.1.12
typescript: 2.4.2
webpack: 3.10.0

Repro steps

serve/build prod and open app, no errors on build and not reproducable with new empty app

Observed behavior

Final Bundle produces:

Uncaught TypeError: Cannot read property 'call' of undefined
    at e (main.5021b2f83dc3e2c2c047.bundle.js:1)
    at Object.t.exports (main.5021b2f83dc3e2c2c047.bundle.js:1)
    at e (main.5021b2f83dc3e2c2c047.bundle.js:1)
    at Object.t.exports (main.5021b2f83dc3e2c2c047.bundle.js:1)
    at e (main.5021b2f83dc3e2c2c047.bundle.js:1)
    at Object.t.exports (main.5021b2f83dc3e2c2c047.bundle.js:1)
    at e (main.5021b2f83dc3e2c2c047.bundle.js:1)
    at Object.t.exports (main.5021b2f83dc3e2c2c047.bundle.js:1)
    at e (main.5021b2f83dc3e2c2c047.bundle.js:1)
    at Object.<anonymous> (main.5021b2f83dc3e2c2c047.bundle.js:1)

Desired behavior

worked in 1.6.3

Mention any other details that might be useful (optional)

tried to track it down, but:

  • ng serve --prod => ERROR
  • ng serve --prod --sourcemaps=true => FINE
  • ng serve --prod --build-optimizer=false => FINE

Most helpful comment

@clydin problem is not fixed with CLI 1.6.5

`-- @angular/[email protected]
  `-- @angular-devkit/[email protected]

All 11 comments

can you try with the following: ng serve --aot --build-optimizer?

thanks for the quick reply:

  • ng serve --aot=true --build-optimizer=true => FINE

Same issue by: ng build --target=production --env=staging --stats-json
@angular/cli: 1.6.3
@angular/compiler-cli: 5.1.3
typescript: 2.5.3
angular-devkit/build-optimizer: 0.0.37

I downgrade the angular-devkit/build-optimizer to 0.0.36 and it's Fine.

I'm facing the same error with the latest Angular and Angular-CLI release. I fixed the browser runtime errors by adding --sourcemaps=true

Uncaught TypeError: Cannot read property 'DATA' of undefined

@danielsogl
the --sourcemaps=true isn't good idea in production

@Blar1975 my project is still in development so its "okay" at this moment.

We are experiencing a similar issue with the latest CLI (1.6.5) and the latest Angular core packages (5.2.1)

My app does not work if it's built with ng build --prod.
Shows the same error as mentioned in original post:

Uncaught TypeError: Cannot read property 'call' of undefined
.   .   .   .

After few experiments we found out that the build configuration that works was:

ng build --prod --aot=false

I see this issue is closed already, so there must be some solution for this problem.
Is it so?

Still having this problem with 1.6.5, is the supposed to be fixed?

@clydin problem is not fixed with CLI 1.6.5

`-- @angular/[email protected]
  `-- @angular-devkit/[email protected]

This time it works with last updates 馃憤 !

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings