diff --git a/src/chart.js b/src/chart.js index 0ee96bd57d4..591572110e8 100644 --- a/src/chart.js +++ b/src/chart.js @@ -56,4 +56,7 @@ plugins.push(require('./plugins/plugin.filler.js')(Chart)); Chart.plugins.register(plugins); -window.Chart = module.exports = Chart; +module.exports = Chart; +if (typeof window !== 'undefined') { + window.Chart = Chart; +} diff --git a/src/core/core.helpers.js b/src/core/core.helpers.js index 2d96ac14b47..5ed5c28edd4 100644 --- a/src/core/core.helpers.js +++ b/src/core/core.helpers.js @@ -669,6 +669,11 @@ module.exports = function(Chart) { }; // Request animation polyfill - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ helpers.requestAnimFrame = (function() { + if (typeof window === 'undefined') { + return function(callback) { + callback(); + }; + } return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame ||