3 ms·
I wonder what justifies turning normal code into a string to eval(): https://github.com/mrdoob/three.js/pull/9310/files#diff-2ac7ae14bafb96167d6b480d86c885feL5
by superswordfish 10y ago
I wonder what justifies turning normal code into a string to eval():
https://github.com/mrdoob/three.js/pull/9310/files#diff-2ac7ae14bafb96167d6b480d86c885feL5 https://github.com/mrdoob/three.js/pull/9310/files#diff-2ac7...
becomes
https://github.com/mrdoob/three.js/pull/9310/files#diff-ff6e5f22a9c7e66987b19c0199636480R4 https://github.com/mrdoob/three.js/pull/9310/files#diff-ff6e...
On the surface it seems bad.
- espadrine 10y agoThis does not look like an eval. It seems to be a script that generates a JS file. The string is not eval'ed, it is concatenated.
- superswordfish 10y agoGood point, either way it is ugly that normal code is now a string. It is in rollup.config.js so maybe this is imposed by "Rollup", but I'm not about to go find how the "outro" option differs from the "footer" option in yet another JS build tool.
- rich_harris 10y agoAudioContext is a special case – unlike most of the THREE.* exports, THREE.AudioContext is a getter (which initializes a Web Audio context). ES module namespaces can't have getters, so for backwards compatibility in the generated UMD bundle it was necessary to add that snippet to the bottom.