make the style-loader throw an exception in a non-browser environment
The intend of the style-loader is to apply styles to the current environment. There is only appropriate behavior defined for browser-like environments. Other environments are not supported and an appropriate loader for that environment should be used instead! #6master
parent
a984af8297
commit
0d5089b5f6
|
@ -2,7 +2,10 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
module.exports = function(cssCode) {
|
||||
module.exports = function addStyle(cssCode) {
|
||||
if(typeof DEBUG !== "undefined" && DEBUG) {
|
||||
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
|
||||
}
|
||||
var styleElement = document.createElement("style");
|
||||
styleElement.type = "text/css";
|
||||
if (styleElement.styleSheet) {
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
module.exports = function(cssUrl) {
|
||||
module.exports = function addStyleUrl(cssUrl) {
|
||||
if(typeof DEBUG !== "undefined" && DEBUG) {
|
||||
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
|
||||
}
|
||||
var styleElement = document.createElement("link");
|
||||
styleElement.rel = "stylesheet";
|
||||
styleElement.type = "text/css";
|
||||
|
|
Loading…
Reference in New Issue