diff --git a/auto.js b/auto.js index b6eb5e78..efc61b8f 100644 --- a/auto.js +++ b/auto.js @@ -1,3 +1,3 @@ -import {setupURLPolyfill} from './index'; +const {setupURLPolyfill} = require('./index'); setupURLPolyfill(); diff --git a/index.js b/index.js index d53c6f14..0522291b 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,17 @@ -import './js/ios10Fix'; +require('./js/ios10Fix'); +const {URL} = require('./js/URL'); +const {URLSearchParams} = require('./js/URLSearchParams'); +const {name, version} = require('./package.json'); -import {name, version} from './package.json'; - -export * from './js/URL'; -export * from './js/URLSearchParams'; - -export function setupURLPolyfill() { +function setupURLPolyfill() { global.REACT_NATIVE_URL_POLYFILL = `${name}@${version}`; global.URL = require('./js/URL').URL; global.URLSearchParams = require('./js/URLSearchParams').URLSearchParams; } + +module.exports = { + URL, + URLSearchParams, + setupURLPolyfill, +}; diff --git a/js/URL.js b/js/URL.js index 720fcff7..cdbc332f 100644 --- a/js/URL.js +++ b/js/URL.js @@ -1,5 +1,5 @@ -import {NativeModules} from 'react-native'; -import {URL as whatwgUrl} from 'whatwg-url-without-unicode'; +const {NativeModules} = require('react-native'); +const {URL: whatwgUrl} = require('whatwg-url-without-unicode'); let BLOB_URL_PREFIX = null; @@ -48,4 +48,4 @@ whatwgUrl.revokeObjectURL = function revokeObjectURL(url) { // Do nothing. }; -export const URL = whatwgUrl; +module.exports.URL = whatwgUrl; diff --git a/js/URLSearchParams.js b/js/URLSearchParams.js index 2f6ff6a9..b70679a0 100644 --- a/js/URLSearchParams.js +++ b/js/URLSearchParams.js @@ -1 +1,3 @@ -export {URLSearchParams} from 'whatwg-url-without-unicode'; +const {URLSearchParams} = require('whatwg-url-without-unicode'); + +module.exports.URLSearchParams = URLSearchParams; diff --git a/js/ios10Fix.js b/js/ios10Fix.js index 4d0e428f..eb7027fd 100644 --- a/js/ios10Fix.js +++ b/js/ios10Fix.js @@ -4,7 +4,7 @@ * See https://github.com/charpeni/react-native-url-polyfill/issues/190 * */ -import {Platform} from 'react-native'; +const {Platform} = require('react-native'); const majorVersionIOS = parseInt(Platform.Version, 10);