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

loadable-components should transpile lazy too #241

Closed
Themezv opened this issue Dec 18, 2023 · 2 comments · Fixed by #242
Closed

loadable-components should transpile lazy too #241

Themezv opened this issue Dec 18, 2023 · 2 comments · Fixed by #242

Comments

@Themezv
Copy link
Contributor

Themezv commented Dec 18, 2023

Plugin loadable-components should transpile lazy from @loadable/component like loadable

Why ?

lazy from @loadable/component supports react Suspense unlike loadable

Helpful info

  1. Original (babel) plugin tests - https://github.com/gregberge/loadable-components/blob/main/packages/babel-plugin/src/index.test.js#L24

  2. Plugin shouldn't transpile lazy if lazy imported not from @loadable/component, because lazy from 'react' (and other libraries) shouldn't be transpiled.

  3. Plugin should transpile lazy if it's renamed import { lazy as renamedLazy } from '@loadable/component'

@Themezv
Copy link
Contributor Author

Themezv commented Jan 10, 2024

If you want to transpile lazy you can use workaround with renaming like

import { lazy as loadable } from '@loadable/components'

@Themezv
Copy link
Contributor Author

Themezv commented Mar 23, 2024

Current swc plugin behavior differs from babel-plugin

It started from gregberge/loadable-components#929

And then gregberge/loadable-components#966

@kdy1 kdy1 assigned kdy1 and unassigned kdy1 Mar 25, 2024
@kdy1 kdy1 closed this as completed in #242 Jul 7, 2024
@kdy1 kdy1 closed this as completed in d911134 Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants