1.5.1 build-optimizer "TypeError: candidate.value.definition is not a function"
See original GitHub issueVersions
Angular CLI: 1.5.1
Node: 6.11.4
OS: win32 x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
@angular/cdk: 5.0.0-rc0
@angular/cli: 1.5.1
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.36
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.1
@schematics/angular: 0.1.5
typescript: 2.4.2
webpack: 3.8.1
Repro steps
- run ng build --prod
- don’t know what this could be related to, since my project is quite large
Observed behavior
ERROR in main.c625bf1271eaaf6ccac7.bundle.js from UglifyJs
TypeError: candidate.value.definition is not a function
at collapse (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:8275:61)
at tighten_body (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:8110:17)
at eval (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:12402:9)
at AST_Node.eval [as optimize] (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:7481:23)
at Object.before (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:7464:24)
at AST_Node.eval [as transform] (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:4559:35)
at eval (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:4688:43)
at Object.before (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:7459:9)
at AST_Node.eval [as transform] (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:4559:35)
at eval (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:4679:43)
at Object.before (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:7459:9)
at AST_Node.eval [as transform] (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:4559:35)
at eval (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:4590:31)
at Object.before (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:7459:9)
at AST_Node.eval [as transform] (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:4559:35)
at eval (eval at <anonymous> (C:\github\web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:0), <anonymous>:4578:25)
It worked with 1.5.0 with --build-optimizer and works with 1.5.1 when specifying --build-optimizer=false.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
candidate.toLowerCase is not a function. (In ... - Stack Overflow
getOptionLabel should return string while top100Films.year returns a number. change the getOptionLabel as below and it'll work fine:
Read more >[Autocomplete] candidate.toLowerCase is not a function #23572
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
Read more >How to fix "Uncaught TypeError: x is not a function" in JavaScript
JS Casts 01 - How to fix "Uncaught TypeError : x is not a function " in JavaScript.Visit https://javascriptcasts.com/episodes/01 for a summary ...
Read more >Uncaught TypeError | Is Not A Function | Solution - YouTube
Have you encountered an error like:- Uncaught TypeError - Some selector is not a function - jQuery is not a function - owlCarousel...
Read more >v2.24.1 PDF - MMDetection's documentation!
rate will be automatically scaled base on this value when the batch size is 16. Meanwhile, in order not to affect other.
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
@kzc awesome, thank you!
For users affected by this problem, here is how you can force your dependencies to use the
uglify-es@3.2.0
.You can’t just add it as a dependency with a new version since the
uglify-es
is not a direct dependency.To see what version you have, run
npm list uglify-es
:To force an indirect dependency to use a new version, you’ll have to update your cache and remove the any package-locks you have. This series of commands should do it:
After all of this, you should be able to see the new version:
I realize this process is cumbersome. NPM does not offer a good way to force update indirect dependencies.
I’ve submitted a PR to update our direct dependency (
uglifyjs-webpack-plugin
): https://github.com/webpack-contrib/uglifyjs-webpack-plugin/pull/176.Then Angular CLI can update to that version and everyone gets the new version of
uglify-es
by default.The bug is present in both branches - latest
uglify-es@3
anduglify-js@3
.You might try using an older version of
uglify-es
in your npm or yarn lock file.