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

Import compensation for React #529

Open
sedx opened this issue Mar 21, 2024 · 0 comments
Open

Import compensation for React #529

sedx opened this issue Mar 21, 2024 · 0 comments

Comments

@sedx
Copy link

sedx commented Mar 21, 2024

We are used Native Federation with Vite and esbuild adapter.

Adapter is not call compensateExports for named imports.

Instead used named imports:

import { lazy }  from 'react';
const Lazy = lazy(() => /** */);

We should use default:

import React from 'react';
const Lazy = React.lazy(() => /** */);

It's not comfortable because:

  • with "jsx": "react-jsx" in tsconfig.json we no need direct import React
  • some libraries use named imports of hooks and etc. and can not find it

I uncomment call of compensateExports #501 and now it works fine.

FIY:
@jogelin - you add todo with question about should we delete unused compensateExports, looks like it's usable feature.
@manfredsteyer - you comment call of compensateExports, maybe you have some reason for do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant