Closed xballoy closed 1 year ago
As it is unlikely that is PR is merge due to no activity on the repository you can use patch-package
to fix it on your project.
Create a file patches/react-virtual-list+2.3.0.patch
with the following content
diff --git a/node_modules/react-virtual-list/lib/utils/throttleWithRAF.js b/node_modules/react-virtual-list/lib/utils/throttleWithRAF.js
index 91a30a0..f36b03f 100644
--- a/node_modules/react-virtual-list/lib/utils/throttleWithRAF.js
+++ b/node_modules/react-virtual-list/lib/utils/throttleWithRAF.js
@@ -3,18 +3,21 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-var _arguments = arguments;
exports.default = function (fn) {
var running = false;
return function () {
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
if (running) return;
running = true;
window.requestAnimationFrame(function () {
- fn.apply(undefined, _arguments);
+ fn.apply(undefined, args);
running = false;
});
3. Clear webpack cache
4. Run `npm install`
It will be very nice if this MR could get merged.
Thanks, @xballoy for the suggestion/temp solution!
@ferdelamad As this PR is probably never gonna be merged I switched to https://github.com/bvaughn/react-window which is actively developed.
Problem addressed
react-virtual-list
package causes error when bundled using webpack 5. Simply addingimport VirtualList from 'react-virtual-list'
to any file produces the following error:That's because webpack 5 uses arrow function to wrap modules but in webpack 4 it was using normal functions.
Solution
As seen on MDN, using rest parameters is a good alternative to using an arguments object.