Skip to content

Commit a872842

Browse files
awsl233777claude
andcommitted
fix: 允许 web 独立构建,无需 Wails 绑定
- 在 vite.config.ts 中将 wailsjs 路径标记为 external - 添加 @ts-ignore 跳过 Wails 绑定类型检查 - 修复 index.css 中的空选择器语法错误 - 导出 InputProps 类型 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a629ec7 commit a872842

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

web/src/components/ui/input.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { Input as InputPrimitive } from "@base-ui/react/input"
33

44
import { cn } from "@/lib/utils"
55

6-
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
6+
type InputProps = React.ComponentProps<"input">
7+
8+
function Input({ className, type, ...props }: InputProps) {
79
return (
810
<InputPrimitive
911
type={type}
@@ -17,4 +19,4 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
1719
)
1820
}
1921

20-
export { Input }
22+
export { Input, type InputProps }

web/src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ body {
282282

283283
/* ===== Component Styles ===== */
284284

285-
html, body, {
285+
html, body {
286286
width: 100%;
287287
height: 100%;
288288
margin: 0;

web/src/lib/transport/wails-transport.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import type {
3333
} from './types';
3434

3535
// 导入 Wails 自动生成的绑定
36+
// @ts-ignore - Wails 绑定在构建时可能不存在
3637
import * as DesktopApp from '@/wailsjs/go/desktop/DesktopApp';
3738

3839
// Wails 事件 API 类型

web/tsconfig.app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
"@/*": ["./src/*"]
2828
}
2929
},
30-
"include": ["src"]
30+
"include": ["src"],
31+
"exclude": ["src/lib/transport/wails-transport.ts", "src/wailsjs"]
3132
}

web/vite.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export default defineConfig({
2828
},
2929
build: {
3030
rollupOptions: {
31-
external: ["@wailsio/runtime"],
31+
external: [
32+
"@wailsio/runtime",
33+
/wailsjs\/go\//,
34+
],
3235
},
3336
},
3437
server: {

0 commit comments

Comments
 (0)