Skip to content

Commit

Permalink
chore(plugins): fix window not defined issue for plugin-kit
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed May 30, 2024
1 parent 630a3b1 commit 822a85c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"vitepress": "1.1.4"
},
"dependencies": {
"@artalk/plugin-katex": "^0.1.8",
"@artalk/plugin-katex": "^0.1.9",
"vue": "^3.4.26"
}
}
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions ui/plugin-katex/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@artalk/plugin-katex",
"version": "0.1.8",
"version": "0.1.9",
"minAppVersion": "2.8.6",
"license": "MIT",
"description": "The katex plugin for artalk",
Expand All @@ -14,9 +14,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"prepublish": "pnpm build",
"publish": "pnpm publish --access=public"
"serve": "vite preview"
},
"dependencies": {
"artalk": "workspace:^",
Expand Down
6 changes: 3 additions & 3 deletions ui/plugin-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@artalk/plugin-kit",
"version": "1.0.0",
"version": "1.0.3",
"description": "The plugin kit for Artalk",
"type": "module",
"main": "dist/main.js",
Expand All @@ -27,10 +27,10 @@
"license": "MIT",
"dependencies": {
"artalk": "workspace:^",
"picocolors": "^1.0.1"
"picocolors": "^1.0.1",
"@microsoft/api-extractor": "^7.46.1"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.46.1",
"esbuild-plugin-raw": "^0.1.8",
"tsup": "^8.0.2"
}
Expand Down
3 changes: 2 additions & 1 deletion ui/plugin-kit/src/plugin/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const ViteArtalkPluginKit = (opts: ViteArtalkPluginKitOptions = {}): Plug
preserveSymlinks: false,
noEmitOnError: undefined,
target: ts.ScriptTarget.ESNext,
moduleResolution: ts.ModuleResolutionKind.Bundler,
outDir: '.',
declarationDir: '.',
}
Expand All @@ -153,7 +154,7 @@ export const ViteArtalkPluginKit = (opts: ViteArtalkPluginKitOptions = {}): Plug
return {
code: `${code}
// Mount plugin to browser window global
if (window) {
if (typeof window !== 'undefined') {
!window.ArtalkPlugins && (window.ArtalkPlugins = {})
window.ArtalkPlugins.${ctx.entryExportName} = ${ctx.entryExportName}
window.Artalk?.use(${ctx.entryExportName})
Expand Down

0 comments on commit 822a85c

Please sign in to comment.