react-virtualized icon indicating copy to clipboard operation
react-virtualized copied to clipboard

unused import bpfrpt_proptype_WindowScroller causing issue in Vite

Open reuben-gomesBP opened this issue 1 year ago • 1 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

on vite this unused import seems to be throwing a build issue

Here is the diff that solved my problem:

diff --git a/node_modules/react-virtualized/dist/es/WindowScroller/utils/onScroll.js b/node_modules/react-virtualized/dist/es/WindowScroller/utils/onScroll.js
index d00f0f1..c8496e8 100644
--- a/node_modules/react-virtualized/dist/es/WindowScroller/utils/onScroll.js
+++ b/node_modules/react-virtualized/dist/es/WindowScroller/utils/onScroll.js
@@ -71,4 +71,3 @@ export function unregisterScrollListener(component, element) {
     }
   }
 }
\ No newline at end of file
-import { bpfrpt_proptype_WindowScroller } from "../WindowScroller.js";
\ No newline at end of file

This issue body was partially generated by patch-package.

reuben-gomesBP avatar Oct 07 '24 10:10 reuben-gomesBP

Me too!

lxlyjss avatar Oct 18 '24 02:10 lxlyjss

Does older version of react-virtualized not having this issue?

ysmood avatar Oct 26 '24 12:10 ysmood

i haven't been able to try with an older version

the issue mainly showed up when migrated to ViteJS

reuben-gomesBP avatar Oct 28 '24 06:10 reuben-gomesBP

  1. How come we are seeing the 9.22.5 in dependencies when it does not even exist? The latest version shown 9.22.4
  2. Can someone explain what this commit achieved? Because it seems to be the root cause of this error

rehangit avatar Nov 01 '24 18:11 rehangit

I also used pnpm patch, you just run pnpm patch react-virtualized, then it will create a patch folder where you can fix it, then just commit and it will create a patch file for you after. Other option is to find a version that works and modify the package.json and make your own npm package with this patch.

mormoassaf avatar Dec 03 '24 10:12 mormoassaf

patch-package totally works for this, but I wanted to throw an alternative out there in case people don't want to use that.

In your package.json:

{
  "postinstall": "npx replace-in-files-cli --string=\"import { bpfrpt_proptype_WindowScroller } from '../WindowScroller.js';\" --replacement='' node_modules/react-virtualized/dist/es/WindowScroller/utils/onScroll.js",
}

Then npm i and you're good to go.

grahamhency avatar Dec 04 '24 15:12 grahamhency

@grahamhency bless you

i noticed for me the import was actually using double quotes so the match didnt work

here's my fixed one

    "postinstall": "npx replace-in-files-cli --string=\"import { bpfrpt_proptype_WindowScroller } from \"../WindowScroller.js\";\" --replacement='' node_modules/react-virtualized/dist/es/WindowScroller/utils/onScroll.js"

sebbean avatar Jan 14 '25 03:01 sebbean