jwagner / simplex-noise.js

A fast simplex noise implementation in Javascript / Typescript.
MIT License
1.61k stars 130 forks source link

SimplexNoise is undefined in webworkers #24

Closed kosshi-net closed 2 years ago

kosshi-net commented 5 years ago

Just calling importScripts() does not bring SimplexNoise to the global scope in webworkers. This at least used to work with earlier versions.

Workaround:

let exports = {};
importScripts('simplex-noise.js');
let SimplexNoise = exports.SimplexNoise;
jwagner commented 2 years ago

This should be resolved by using es modules now. https://web.dev/module-workers/