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

Migrate to import * as React from 'react' #954

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

TrySound
Copy link
Contributor

What:

Migrated to import * as React from 'react'

Why:

Ref facebook/react#18102

This is the recommended way to import react now.

How:

With the help of replace-in-files-cli package

Checklist:

  • Documentation
  • Tests
  • TypeScript Types
  • Flow Types
  • Ready to be merged

Ref facebook/react#18102

This is the recommended way to import react now.
@silviuaavram
Copy link
Collaborator

Shouldn't we get warning from React? I don't see this being enforced. And could not tell from that issue if it's something that brings any value. Can you describe this a bit so we can have more context? Thank you!

@TrySound
Copy link
Contributor Author

TrySound commented Apr 6, 2020

I don't think it's easy to add warning before migrating to esm.

There is a value with bundlers like rollup when target format is esm.

When bundle apps you get optimisable output with named exports

import { e as createElement } from 'react';
createElement('div')

Default exports leads to hard member expression which can be optimised by babel or webpack plugins but not in natural way

import React from 'react';
React.createElement('div')

@oliviertassinari
Copy link
Contributor

oliviertassinari commented Apr 6, 2020

@silviuaavram They might be a bit more context in mui/material-ui#19802.

@silviuaavram
Copy link
Collaborator

Understood :) will merge this, thank you!

@silviuaavram silviuaavram merged commit ccf514d into downshift-js:master Apr 7, 2020
@silviuaavram
Copy link
Collaborator

🎉 This PR is included in version 5.0.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants