SimplexNoise error

Hi guys,

I kept getting error because “Uncaught (in promise) TypeError: SimplexNoise is not a constructor”. Could you help me, please?

You are importing simplex-noise v4

But importing and instantiating it, as if it is v3

// 3.x
import SimplexNoise from 'simplex-noise';
const simplex = new SimplexNoise();
const value2d = simplex.noise2D(x, y);
// 4.x
// import the functions you need
import { createNoise2D } from 'simplex-noise';
const noise2D = createNoise2D();
const value2d = noise2D(x, y);

Refer to official documentation

It works. Thank you so much for the help.

1 Like