fix(storybook): type the font path plugin as a Vite Plugin
this.warn() in the hm-ui-theme-font-path transform failed tsc -b with TS2339 because the untyped object literal made `this` the literal itself. Annotate it as Vite's Plugin so `this` is the plugin context. Font URL replacement and the warning behavior are unchanged.
This commit is contained in:
1 parent
074ed8706b
commit
2e203627c5
1 file changed
+2
-1
+2
-1
@@ -2,6 +2,7 @@ import type { StorybookConfig } from "@storybook/react-vite"
|
|||||||
import { readFileSync, realpathSync } from "node:fs"
|
import { readFileSync, realpathSync } from "node:fs"
|
||||||
import { fileURLToPath } from "node:url"
|
import { fileURLToPath } from "node:url"
|
||||||
import path from "node:path"
|
import path from "node:path"
|
||||||
|
import type { Plugin } from "vite"
|
||||||
|
|
||||||
// Checkouts that share another checkout's node_modules (a linked git worktree whose node_modules is a junction) also
|
// Checkouts that share another checkout's node_modules (a linked git worktree whose node_modules is a junction) also
|
||||||
// inherit that checkout's node_modules/@hm-design/* links. Those links point at the other checkout's packages/ui and its
|
// inherit that checkout's node_modules/@hm-design/* links. Those links point at the other checkout's packages/ui and its
|
||||||
@@ -35,7 +36,7 @@ const localUiAliases = [
|
|||||||
const UI_DIST_FONT_URL = /[^"'()\\\s]*\/ui\/dist\/fonts\/NotoSansKR-variable\.ttf/g
|
const UI_DIST_FONT_URL = /[^"'()\\\s]*\/ui\/dist\/fonts\/NotoSansKR-variable\.ttf/g
|
||||||
const FONT_STATIC_URL = "/fonts/NotoSansKR-variable.ttf"
|
const FONT_STATIC_URL = "/fonts/NotoSansKR-variable.ttf"
|
||||||
|
|
||||||
const hmUiThemeFontPath = {
|
const hmUiThemeFontPath: Plugin = {
|
||||||
name: "hm-ui-theme-font-path",
|
name: "hm-ui-theme-font-path",
|
||||||
apply: "serve" as const,
|
apply: "serve" as const,
|
||||||
enforce: "post" as const,
|
enforce: "post" as const,
|
||||||
|
|||||||
Reference in new issue
Block a user