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

Error in import package.json #448

Closed
lokiikoll opened this issue Jun 3, 2023 · 1 comment · Fixed by #458
Closed

Error in import package.json #448

lokiikoll opened this issue Jun 3, 2023 · 1 comment · Fixed by #458

Comments

@lokiikoll
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-url-polyfill@1.3.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-url-polyfill/index.js b/node_modules/react-native-url-polyfill/index.js
index 675947e..e832063 100644
--- a/node_modules/react-native-url-polyfill/index.js
+++ b/node_modules/react-native-url-polyfill/index.js
@@ -2,13 +2,13 @@ import './js/ios10Fix';
 
 import {polyfillGlobal} from 'react-native/Libraries/Utilities/PolyfillFunctions';
 
-import {name, version} from './package.json';
+import packageJson from './package.json';
 
 export * from './js/URL';
 export * from './js/URLSearchParams';
 
 export function setupURLPolyfill() {
-  global.REACT_NATIVE_URL_POLYFILL = `${name}@${version}`;
+  global.REACT_NATIVE_URL_POLYFILL = `${packageJson.name}@${packageJson.version}`;
 
   polyfillGlobal('URL', () => require('./js/URL').URL);
   polyfillGlobal(

This issue body was partially generated by patch-package.

@charpeni
Copy link
Owner

Hello 👋

Thanks for filling this in.

Is this to fix the following error:

Error: Should not import the named export 'name' (imported as 'name') from default-exporting module (only default export is available soon)

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

Successfully merging a pull request may close this issue.

2 participants