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

it doesn't work for rxjs #604

Open
baiterry opened this issue Apr 6, 2022 · 1 comment
Open

it doesn't work for rxjs #604

baiterry opened this issue Apr 6, 2022 · 1 comment

Comments

@baiterry
Copy link

baiterry commented Apr 6, 2022

In my React Native project, I tried to import rxjs with this plugin.

Here's my babel.config.js

[
    'import',
    {
        libraryName: "rxjs",
        camel2DashComponentName: false,
        customName: (name, file) => {
            if (['debounceTime', 'throttleTime'].includes(name)) {
                return `rxjs/internal/operators/${name}`;
            }
            return `rxjs/internal/${name}`;
        }
    }
]

But I got problem that said TypeError: _Subject2.default is not a constructor.... And ideas?

p.s.
I've tried to manually change the import statement, like:

// import {debounceTime} from 'rxjs';
import {debounceTime} from 'rxjs/internal/operators/debounceTime';

And it worked. So cleanly there was something wrong when I used this plugin.

@FlorianWendelborn
Copy link

Have you tried setting transformToDefaultImport to false?

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

2 participants