diff --git a/components/carousel/index.jsx b/components/carousel/index.jsx index 4a729a3b5e..62c3a3d1bd 100644 --- a/components/carousel/index.jsx +++ b/components/carousel/index.jsx @@ -1,3 +1,18 @@ +// matchMedia polyfill for +// https://github.com/WickyNilliams/enquire.js/issues/82 +if (typeof window !== 'undefined') { + const matchMediaPolyfill = function matchMediaPolyfill() { + return { + matches: false, + addListener: function () { + }, + removeListener: function () { + } + }; + }; + window.matchMedia = window.matchMedia || matchMediaPolyfill; +} + import Carousel from 'react-slick'; import React from 'react'; import assign from 'object-assign'; diff --git a/index.js b/index.js index f2d2ee1476..04479d5d17 100644 --- a/index.js +++ b/index.js @@ -2,21 +2,6 @@ import React from 'react'; require('./style/index.less'); -// matchMedia polyfill for -// https://github.com/WickyNilliams/enquire.js/issues/82 -if (typeof window !== 'undefined') { - const matchMediaPolyfill = function matchMediaPolyfill() { - return { - matches: false, - addListener: function () { - }, - removeListener: function () { - } - }; - }; - window.matchMedia = window.matchMedia || matchMediaPolyfill; -} - const antd = { Affix: require('./components/affix'), Datepicker: require('./components/datepicker'),