Skip to content

TypeError: Cannot read property 'call' of undefined #14779

@JohanBeumer

Description

@JohanBeumer

🐞 Bug report

Command (mark with an x)

- [ ] new
- [x] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

I don't know what version it was, but when uglifyjs instead of terser was used it worked

Description

A clear and concise description of the problem...

The problem I have is that when I use a custom webpack.config in an attempt to prevent certain keywords (classnames in my case) from being mangled it does not work and still mangles the classname. This happens when I start the app with ng serve --prod --aot
I expect the page to show :

Classname is Foo

But in my case it shows :

ClassName is ip

When I build the app with ng build --prod --aot and then start the app I get the error as shown by "Exception or Error".

🔬 Minimal Reproduction

You can reproduce the issue by cloning this repo and use any of these commands :

- ng serve --prod --aot
- ng build --prod --aot

🔥 Exception or Error

Running the result of ng build --prod --aot gives this error :



runtime-es2015.29bb7a5678a9e1bc4d05.js:1 Uncaught TypeError: Cannot read property 'call' of undefined
    at f (runtime-es2015.29bb7a5678a9e1bc4d05.js:1)
    at Object.1 (polyfills-es2015.8f5c586921f6179cdfaf.js:1)
    at f (runtime-es2015.29bb7a5678a9e1bc4d05.js:1)
    at e (runtime-es2015.29bb7a5678a9e1bc4d05.js:1)
    at Array.r [as push] (runtime-es2015.29bb7a5678a9e1bc4d05.js:1)
    at polyfills-es2015.8f5c586921f6179cdfaf.js:1
f @ runtime-es2015.29bb7a5678a9e1bc4d05.js:1
1 @ polyfills-es2015.8f5c586921f6179cdfaf.js:1
f @ runtime-es2015.29bb7a5678a9e1bc4d05.js:1
e @ runtime-es2015.29bb7a5678a9e1bc4d05.js:1
r @ runtime-es2015.29bb7a5678a9e1bc4d05.js:1
(anonymous) @ polyfills-es2015.8f5c586921f6179cdfaf.js:1

🌍 Your Environment



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.0.2
Node: 11.12.0
OS: win32 x64
Angular: 8.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.2
@angular-devkit/build-angular     0.800.2
@angular-devkit/build-optimizer   0.800.2
@angular-devkit/build-webpack     0.800.2
@angular-devkit/core              8.0.2
@angular-devkit/schematics        8.0.2
@angular/cli                      8.0.2
@ngtools/webpack                  8.0.2
@schematics/angular               8.0.2
@schematics/update                0.800.2
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.33.0

Anything else relevant?

Don't now if it's browser specific. I'm getting it in Google chrome version 75.0.3770.90 (Official Build) (64-bit)

I created an issue with webpack, but I got asked by @filipesilva to create the issue with angular-cli.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions