diff --git a/.umirc.ts b/.umirc.ts index 8116379..850fd15 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -7,8 +7,8 @@ export default defineConfig({ logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', outputPath: '.doc', exportStatic: {}, - base: '/', - publicPath: '/', + base: '/cssinjs/', + publicPath: '/cssinjs/', hash: true, styles: [ ` diff --git a/src/useCacheToken.tsx b/src/useCacheToken.tsx index ac46688..d285270 100644 --- a/src/useCacheToken.tsx +++ b/src/useCacheToken.tsx @@ -17,11 +17,13 @@ function recordCleanToken(tokenKey: string) { } function removeStyleTags(key: string) { - const styles = document.querySelectorAll(`style[data-token-key="${key}"]`); + if (typeof document !== 'undefined') { + const styles = document.querySelectorAll(`style[data-token-key="${key}"]`); - styles.forEach((style) => { - style.parentNode?.removeChild(style); - }); + styles.forEach((style) => { + style.parentNode?.removeChild(style); + }); + } } // Remove will check current keys first