diff --git a/src/core/index.js b/src/core/index.js index 14c0637f4ebfb5efbf3a2ec5de885c05bd3bf634..c34b91b67b0a9cef2f5e939b63a9e987c64fbc09 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -3,11 +3,12 @@ import deepExtend from "deep-extend" import System from "core/system" import win from "core/window" import ApisPreset from "core/presets/apis" + import * as AllPlugins from "core/plugins/all" import { parseSearch } from "core/utils" -if (process.env.NODE_ENV !== "production") { - window.Perf = require("react-addons-perf") +if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") { + win.Perf = require("react-addons-perf") } // eslint-disable-next-line no-undef diff --git a/src/core/utils.js b/src/core/utils.js index 5f86f6d424431d03e003497db62f9ac455590dc5..a809b343ddaf046c22bb83583417ae88e7e94c90 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -607,7 +607,10 @@ export const getSampleSchema = (schema, contentType="", config={}) => { export const parseSearch = () => { let map = {} - let search = window.location.search + let search = win.location.search + + if(!search) + return {} if ( search != "" ) { let params = search.substr(1).split("&") diff --git a/src/polyfills.js b/src/polyfills.js index a4ef6ea00421070dd27b1e1390065d44eec6fee2..312d88dcbe7054bb7c0ed5fabedd4cce620d0aaf 100644 --- a/src/polyfills.js +++ b/src/polyfills.js @@ -1,6 +1,6 @@ // Promise global, Used ( at least ) by 'whatwg-fetch'. And required by IE 11 -if(!window.Promise) { +if(typeof Promise === "undefined") { require("core-js/fn/promise") }