D3 Migration issues

“d3-axis”: “^3.0.0”,
“d3-color”: “^2.0.0”,
“d3-format”: “^1.3.0”,
“d3-scale”: “^2.0.0”,
“d3-selection”: “^3.0.0”,
“d3-shape”: “^1.2.0”,

I am migrating above to the latest d3 packages, I have looked up the functions they are not been replaced. For example when i try to access any of the packages after updating I get the object as an empty object.

import { mean } from ‘d3-array’; // this would be undefined.

This similar behavior is hapening for every package.
I have tried removing all of the packages and just install d3 but that doesnt helps.
I have tried updating all packages independantly still no luck.

Your code seems correct:

import { mean } from "d3-array";

are you listing d3-array in your package dependencies?

Previously yes but now I am adding complete d3 package:
“d3”: “^7.9.0”,

Also do i need to worry about it running on server side? but previously it worked fine.

Did you try to import from “d3” instead of “d3-array”?

with only ‘d3’ it just breaks with ‘d3-array’ it gives me undefined

Maybe the issue is the project is using commonjs? but we have the preset env set

Could you describe your environment? After adding d3 to your package.json file, are you installing it with npm or yarn? Do you see d3 in your node_modules folder?