Skip to content

Commit

Permalink
fix: verify if document exists
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielzevedo committed Jun 11, 2024
1 parent f0e58c9 commit 74bd94f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ import {css} from "lit-element/lit-element.js";
export default css\`${cssText.replace(/([$`\\])/g, '\\$1')}\`;
`

const styleModule = (cssText: string, nonce?: string) => nonce ? `\
const styleModule = (cssText: string, nonce?: string) => typeof document !== 'undefined' ? nonce ? `\
const css = \`${cssText.replace(/([$`\\])/g, '\\$1')}\`;
const style = document.createElement("style");
style.setAttribute("nonce", ${nonce});
Expand All @@ -115,7 +115,7 @@ document.head
.appendChild(document.createElement("style"))
.appendChild(document.createTextNode(css));
export {css};
`
` : ''

export function makeModule(contents: string, type: Type, nonce?: string):string {
switch (type) {
Expand Down

0 comments on commit 74bd94f

Please sign in to comment.