Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed missed minified builds; (#4805)
* Fixed missed minified builds; Refactored utils.js; Refactored `utils.isStandardBrowserEnv()` as a `platform/browser` property; Added builds size log; * Replaced `rollup-plugin-filesize` with `rollup-plugin-bundle-size`; Co-authored-by: Jay <jasonsaayman@gmail.com>
- Loading branch information
1 parent
d17d9a6
commit cd8989a
Showing
8 changed files
with
254 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,43 @@ | ||
import URLSearchParams from './classes/URLSearchParams.js' | ||
import FormData from './classes/FormData.js' | ||
|
||
/** | ||
* Determine if we're running in a standard browser environment | ||
* | ||
* This allows axios to run in a web worker, and react-native. | ||
* Both environments support XMLHttpRequest, but not fully standard globals. | ||
* | ||
* web workers: | ||
* typeof window -> undefined | ||
* typeof document -> undefined | ||
* | ||
* react-native: | ||
* navigator.product -> 'ReactNative' | ||
* nativescript | ||
* navigator.product -> 'NativeScript' or 'NS' | ||
* | ||
* @returns {boolean} | ||
*/ | ||
const isStandardBrowserEnv = (() => { | ||
let product; | ||
if (typeof navigator !== 'undefined' && ( | ||
(product = navigator.product) === 'ReactNative' || | ||
product === 'NativeScript' || | ||
product === 'NS') | ||
) { | ||
return false; | ||
} | ||
|
||
return typeof window !== 'undefined' && typeof document !== 'undefined'; | ||
})(); | ||
|
||
export default { | ||
isBrowser: true, | ||
classes: { | ||
URLSearchParams, | ||
FormData, | ||
Blob | ||
}, | ||
isStandardBrowserEnv, | ||
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] | ||
}; |
Oops, something went wrong.