Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esm output provides wrong import statement #1212

Closed
TrySound opened this issue Sep 12, 2018 · 14 comments
Closed

esm output provides wrong import statement #1212

TrySound opened this issue Sep 12, 2018 · 14 comments
Labels

Comments

@TrySound
Copy link
Contributor

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

@brigand
Copy link

brigand commented Sep 12, 2018

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';

@remorses
Copy link

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';

@YurySolovyov
Copy link

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
  ],
});

@lucantini
Copy link

@YurySolovyov This is a good patch fix for this issue, but this needs to be resolved in a later release of react-virtualized!

@kitsune7
Copy link

kitsune7 commented Aug 5, 2021

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]
    }
  }
});

@lucantini
Copy link

This problem also happens when building with rollup. Can we remove this particular import since this variable doesn't seem to exist?

@jasonwilliams
Copy link

jasonwilliams commented Dec 17, 2021

This is still an issue for us when building with esbuild.

@intafon
Copy link

intafon commented Jan 10, 2022

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. :-)

@jasonwilliams
Copy link

@intafon if you need a quick fix #1212 (comment) 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. 2e962d8

@VladBrok
Copy link

It's still an issue in 2023 vite v4.3.8

@VladBrok
Copy link

image

please fix (((

@kaiyoma
Copy link

kaiyoma commented May 22, 2023

Also hitting this issue. Please fix!

@H0JLuk
Copy link

H0JLuk commented Jul 10, 2023

Hotfix for this issue has been resolved above at the comment
comment

@abemedia
Copy link

I wrote an esbuild plugin to fix this: https://npmjs.com/package/esbuild-plugin-react-virtualized

@github-actions github-actions bot added the Stale label Oct 3, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests