From d5f6b00e8eb71502c297598b64a39db5cb1ecae4 Mon Sep 17 00:00:00 2001 From: Mikol Graves Date: Tue, 18 Oct 2016 08:35:22 -0700 Subject: [PATCH] Check for DOM in CSSPluginBase.prototype.instantiate() --- css-plugin-base.js | 4 ++-- test/bundle.js | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/css-plugin-base.js b/css-plugin-base.js index 8a8ce77..3d54c8f 100644 --- a/css-plugin-base.js +++ b/css-plugin-base.js @@ -58,8 +58,8 @@ CSSPluginBase.prototype.listAssets = function(loads, opts) { */ // NB hot reloading support here CSSPluginBase.prototype.instantiate = function(load) { - if (this.builder) - return; + if (this.builder || typeof document === 'undefined') + return; var style = document.createElement('style'); style.type = 'text/css'; diff --git a/test/bundle.js b/test/bundle.js index 3230547..11a1a20 100644 --- a/test/bundle.js +++ b/test/bundle.js @@ -4,6 +4,4 @@ System.registerDynamic("test/data/test.css!css.js", [], false, function ($__requ (function ($__global) {})(this); return _retrieveGlobal(); -}); -(function(c){if (typeof document == 'undefined') return; var d=document,a='appendChild',i='styleSheet',s=d.createElement('style');s.type='text/css';d.getElementsByTagName('head')[0][a](s);s[a](d.createTextNode(c));}) -("@import \"./dep.css\";body{background-color:red;background-image:url(test/data/x.png)}\n/*# sourceMappingURL=__.css.map */"); \ No newline at end of file +}); \ No newline at end of file