Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught TypeError: t.rgb is not a function

Uncaught TypeError: t.rgb is not a function

I created an angular application, built it, and am attempting to serve it

$ ng serve --prod --aot 

This results in the following error in the console

Uncaught TypeError: t.rgb is not a function
    at HO (color.js.pre-build-optimizer.js:227)
    at GO (color.js.pre-build-optimizer.js:232)
    at rgb.js.pre-build-optimizer.js:36
    at RH (ramp.js.pre-build-optimizer.js:4)
    at Module.zUnb (BrBG.js.pre-build-optimizer.js:16)
    at f (bootstrap:78)
    at Object.0 (index.js.pre-build-optimizer.js:26)
    at f (bootstrap:78)
    at t (bootstrap:45)
    at Array.r [as push] (bootstrap:32)

The application does not display

When I build the application without minifying (the --prod flag) it works.

I am only seeing this issue when using D3

D3 ^5.9.1 . Angular version 7.3.9 . typescript 3.2.4

I have tried many combinations of versions with no luck.

It also runs successfully when I pass --optimization=false I have been unable to debug this so far. This is very similar to this question however the solutions does not apply to this situation

Please let me know if any additional information would be useful.

like image 403
johnchase Avatar asked Oct 21 '19 23:10

johnchase


1 Answers

I have downgraded the version of d3 to 4.13.0 instead of 5.9.2.

npm install [email protected]

The issue is d3-color.

Hope it helped.

like image 71
Itay Ben Shmuel Avatar answered Oct 06 '22 01:10

Itay Ben Shmuel