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

Fix usage with commonjs modules #228

Merged
merged 3 commits into from
Feb 11, 2019
Merged

Conversation

bertho-zero
Copy link
Contributor

No description provided.

@theKashey
Copy link
Collaborator

That would be a breaking change.
The code you have written is true only for babel-compiled scripts, while TypeScript has a different "default" behaviour.

First of all - what problem you are trying to solve?

@bertho-zero
Copy link
Contributor Author

bertho-zero commented Feb 8, 2019

I thought it was a universal solution.
For another configuration problem, I had a module that exported undefined, and I had a component {default: undefined, __esModule: true, ...} in React.

@theKashey
Copy link
Collaborator

theKashey commented Feb 9, 2019

What about picking default when you are sure you could do it, and using the old behavior in any other case?

loadedModule.__esModule ? loadedModule.default :  (loadedModule.default || loadedModule)

@theKashey
Copy link
Collaborator

👍

@gregberge gregberge merged commit 3628363 into gregberge:master Feb 11, 2019
@gregberge
Copy link
Owner

Thanks!

fivethreeo pushed a commit to fivethreeo/loadable-components that referenced this pull request Nov 16, 2022
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

Successfully merging this pull request may close these issues.

3 participants