I am really struggling with getting D3.js working in my Phoenix app. I have a default Phoenix umbrella app with webpack.
Steps that I have done so far:
Added "d3": ">=5.9.1" to my assets/package.json
Added import "d3" to my assets/js/app.js
Confirmed that the app.js that is loaded in the browser does indeed contain the d3 library.
But no matter what I seem to do every time I try to use d3 I get:
ReferenceError: d3 is not defined
I have looked through the d3 code, and it does not assign the d3 variable anywhere. I can search for d3 = or with regex d3\s*= but I get nothing. Maybe this is why the import is not working? Maybe a different import method is required?
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
(v)ersion (k)ill (D)b-tables (d)istribution
d3jsDemo $ cd assets
assets $ npm i d3 -D
npm WARN assets No description
added 33 packages from 1 contributor and audited 14506 packages in 7.422s
found 2 low severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details