react-virtualized
react-virtualized copied to clipboard
esm output provides wrong import statement
There is in the end unused and not existing import. Seems like generated by mistake https://unpkg.com/[email protected]/dist/es/WindowScroller/utils/onScroll.js
import { bpfrpt_proptype_WindowScroller } from '../WindowScroller.js';
/cc @brigand
Hey, this is expected behavior of the plugin, but since bpfrpt_proptype_WindowScroller
isn't used anywhere, we'd ideally remove it. However, this requires some form of escape-analysis, which is a bit tricky. Created an issue.
If a quick fix is needed, you can add this line to the file:
'no babel-plugin-flow-react-proptypes';
I cannot build the package with esbuild because of this issue
error: No matching export for import "bpfrpt_proptype_WindowScroller"
75 │ import { bpfrpt_proptype_WindowScroller } from '../WindowScroller.js';
For esbuild, i've redirected imports to umd and it seems to work
const resolveFixup = {
name: 'resolve-fixup',
setup(build) {
build.onResolve({ filter: /react-virtualized/ }, async args => {
return {
path: path.resolve('./node_modules/react-virtualized/dist/umd/react-virtualized.js'),
}
})
},
};
esbuild.build({
plugins: [
resolveFixup,
// your plugins
],
});
@YurySolovyov This is a good patch fix for this issue, but this needs to be resolved in a later release of react-virtualized
!
For anyone using Vite v2.3.0 or newer, you can apply the esbuild plugin that @YurySolovyov wrote above by modifying your Vite config to include the following:
export default defineConfig({
optimizeDeps: {
esbuildOptions: {
plugins: [resolveFixup]
}
}
});
This problem also happens when building with rollup
. Can we remove this particular import since this variable doesn't seem to exist?
This is still an issue for us when building with esbuild.
Yeh, I worked through several issues I had trying out esbuild and using a lerna monorepo, and after all those were resolved I hit this. Bumping this in hopes it gets attention. :-)
@intafon if you need a quick fix https://github.com/bvaughn/react-virtualized/issues/1212#issuecomment-847759202 solution worked for me.
In terms of this being fixed in general, it's already been fixed and merged but it seems to be stuck on being published. https://github.com/bvaughn/react-virtualized/commit/2e962d8f8aebc22cb1168a8d147bcaa1d27aa326
It's still an issue in 2023 vite v4.3.8
please fix (((
Also hitting this issue. Please fix!
Hotfix for this issue has been resolved above at the comment comment
I wrote an esbuild plugin to fix this: https://npmjs.com/package/esbuild-plugin-react-virtualized