Skip to content

Commit 23f3ea4

Browse files
authored
Merge pull request #41 from kingyue737/patch-2
feat: guard for node
2 parents e401ce7 + 94a02c0 commit 23f3ea4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default (options = {}) => {
8888
/* if inject is enabled, we want to simply inject the stylesheet into the document head */
8989
if (options.inject) {
9090
return {
91-
code: `document.head.appendChild(document.createElement("style")).textContent=${JSON.stringify(transformedCode)};`,
91+
code: `if(typeof document!=='undefined')document.head.appendChild(document.createElement("style")).textContent=${JSON.stringify(transformedCode)};`,
9292
map: null
9393
};
9494
}

0 commit comments

Comments
 (0)