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

[change] Remove default ES Module export #1277

Closed
wants to merge 1 commit into from

Conversation

necolas
Copy link
Owner

@necolas necolas commented Mar 8, 2019

Remove the default export that was provided for compatibility with legacy
imports of React Native CommonJS modules. These patterns is no longer
supported:

import ReactNative from 'react-native';
const ReactNative = require('react-native');

Fix #1258

Remove the default export that was provided for compatibility with legacy
imports of React Native CommonJS modules. These patterns is no longer
supported:

```
import ReactNative from 'react-native';
const ReactNative = require('react-native');
```

Fix #1258
@necolas necolas closed this in 69bd0f6 Mar 11, 2019
@necolas necolas deleted the react-native-web/no-default-export branch March 15, 2019 17:35
kmagiera pushed a commit to software-mansion/react-native-gesture-handler that referenced this pull request Jun 1, 2019
# Why

Default import was removed from react-native-web. necolas/react-native-web#1277
The use of module.exports and import/export breaks tree-shaking in with babel-preset-expo.

Related: #617
Fixes: expo/expo#4339

# How

* Moved the shims to `Gestures(.web).js`
* Moved all modules out of main re-export file. (optional)
@joan-saum
Copy link

Hi @necolas

I'm not sure to understand why the default has been removed.
In my project, some dependencies try to access to the default export of react-native. It only works if i add the export default you removed here

See my issue for more information : #1366

Is there any other way to make it work without change the export ?

@paularmstrong
Copy link
Contributor

paularmstrong commented Jun 24, 2019

@joan-saum Please see the related issue: #1258 and facebook/metro#362

janicduplessis pushed a commit to janicduplessis/react-native-gesture-handler that referenced this pull request Feb 16, 2020
# Why

Default import was removed from react-native-web. necolas/react-native-web#1277
The use of module.exports and import/export breaks tree-shaking in with babel-preset-expo.

Related: software-mansion#617
Fixes: expo/expo#4339

# How

* Moved the shims to `Gestures(.web).js`
* Moved all modules out of main re-export file. (optional)
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.

Remove default import
3 participants