unused import bpfrpt_proptype_WindowScroller causing issue in Vite
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.
Me too!
Does older version of react-virtualized not having this issue?
i haven't been able to try with an older version
the issue mainly showed up when migrated to ViteJS
- How come we are seeing the 9.22.5 in dependencies when it does not even exist? The latest version shown 9.22.4
- Can someone explain what this commit achieved? Because it seems to be the root cause of this error
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.
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 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"