Fix node-fetch bundling
Summary: In electron setup, bundlers usually bundle for browser environments. In browser envs, bundles seem to pick up .mjs files first. .mjs fro node-fetch exports fetch as a default export. This fix allows bundling of npm-api for electron. Closes https://github.com/facebook/flipper/issues/3752 https://github.com/doowb/npm-api/pull/25/files Reviewed By: lblasa Differential Revision: D36758469 fbshipit-source-id: bf6c27ed37cb0baa54382ea563902e6e77a118e9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
48fec52610
commit
c2a17873cb
15
desktop/patches/npm-api+1.0.1.patch
Normal file
15
desktop/patches/npm-api+1.0.1.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
diff --git a/node_modules/npm-api/lib/registry.js b/node_modules/npm-api/lib/registry.js
|
||||
index daca66a..38e0ae9 100644
|
||||
--- a/node_modules/npm-api/lib/registry.js
|
||||
+++ b/node_modules/npm-api/lib/registry.js
|
||||
@@ -1,6 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
-const fetch = require('node-fetch');
|
||||
+let fetch = require('node-fetch');
|
||||
+if (fetch.default) {
|
||||
+ fetch = fetch.default
|
||||
+}
|
||||
const utils = require('./utils');
|
||||
const config = require('./config');
|
||||
|
||||
Reference in New Issue
Block a user