Closed derhuerst closed 5 years ago
Let me know if you want a PR for this.
Hey @derhuerst , Thanks for the feedback. I'm a bit confused. Webpack produces UMD builds so it should be usable in Node as well. Do you have any info on this? Feel free to open a PR if you have a good solution for this. Thanks.
True, indeed it's not related to the bundling itself (although I still think it would be good to have transpiled, unbundled code in the npm package as well), but to Webpack. After a quick search, I found https://github.com/webpack/webpack/issues/6522#issuecomment-366704672 .
Thanks for the link. I made the change and it seems to work. Hopefully won't break any other environment. Published new npm package version (2.0.1). Please check when you have some time.
> algorithmic-vomit@0.1.1 test /home/travis/build/derhuerst/algorithmic-vomit
> ./cli.js worley
cWkacnQmjGHCUfdtdEqTDMEWymRWlLjaNiiooaZGmDPWTKdGrcIaPYHHyZPTNpLweaTtsZOasyJFoCJqJwebpack://WorleyNoise/./src/worley-noise.js?:127
this._points[minIdx].selected = true;
^
TypeError: Cannot set property 'selected' of undefined
at WorleyNoise._calculateValue (webpack://WorleyNoise/./src/worley-noise.js?:127:39)
at WorleyNoise.getManhattan (webpack://WorleyNoise/./src/worley-noise.js?:52:19)
at worley (/home/travis/build/derhuerst/algorithmic-vomit/cli.js:19:42)
at color (/home/travis/build/derhuerst/algorithmic-vomit/index.js:14:34)
at fill (/home/travis/build/derhuerst/algorithmic-vomit/index.js:25:14)
at Object.<anonymous> (/home/travis/build/derhuerst/algorithmic-vomit/cli.js:28:26)
at Module._compile (internal/modules/cjs/loader.js:734:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
at Module.load (internal/modules/cjs/loader.js:626:32)
at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
I've looked at your code. The cause of the problem is an API change. The getManhattan
function now expects an object with x
and y
property. It's updated in the readme.
worley.getManhattan({ x: x/40, y: y/45 }, 2)
should work.
Thanks!
I can't use
worley-noise@2.0.0
with Node, becausesrc/worley-noise.js
is an ES module, anddist/worley-noise.js
expectswindow
to be in the global scope.It would be cool to be able to use the package in Node
6
without further steps. One solution would be tobabel
-transpile the src code intodist
and expose a bundle in addition.