#frontend
共 78 篇文章
解决 Pinia 解构 store 属性丢失响应式 storeToRefs 修复
排查 在 Vue 3 组件中使用 ES6 解构赋值 const { token, userInfo } = useUserStore() 导致状态更新后视图不刷新问题,分析 Pinia state 响应式原理与 storeToRefs 解决方案。
解决 TypeScript 报错 TS7016: Could not find a declaration file for module 修复
排查 TypeScript 导入外部 npm 包提示 TS7016: Could not find a declaration file for module 错误,安装 @types 或编写自定义 shims 声明补齐。
解决 NgRx 派发 Action 后 State 未更新缺少 Reducer 注册修复
排查 在 Angular 应用中使用 NgRx 架构时 Store.dispatch(loadSuccess()) 成功触发但在 Redux DevTools 中状态无变化,分析 StoreModule.forFeature 注册与不可变 Reducer 逻辑。
解决 Remix 报错 Hydration failed because server rendered HTML didn't match 水合不一致修复
排查 Remix (React Router v7) 首次加载页面时控制台红屏警告 Hydration failed because the initial UI does not match,分析 服务端渲染与浏览器特有 API 差异。
解决 Effector 报错 Scope not found for unit 服务端渲染水合隔离修复
排查 在 Next.js 或 SSR 环境中使用 Effector 进行状态管理时报出 Scope not found for unit 或多请求状态串扰问题,分析 fork(domain) 与 allSettled 作用域隔离机制。
解决 Vuex 报错 unknown action type 命名空间模块派发失败修复
排查 在 Vue 2/3 项目中使用 Vuex 命名空间模块时通过 this.$store.dispatch('fetchList') 报错 [vuex] unknown action type,分析 namespaced 模块路径前缀与全局派发 root 选项。
解决 TypeScript 报错 TS2322: Type is not assignable to type 类型收敛修复
排查 TypeScript 编译提示 TS2322: Type '...' is not assignable to type '...' 错误,深度解析联合类型、严格可选属性与类型断言最佳实践。
解决 MobX reaction 与 autorun 未释放引起的内存泄漏与重复执行修复
排查 在 React 组件生命周期中使用 MobX reaction 或 autorun 监听状态但在组件卸载时未执行 disposer() 导致内存持续增长与僵尸监听,分析副作用清理与 useEffect 清理函数实现。
解决 ESLint 报错 Parsing error The keyword import is reserved
解决 ESLint 在检查 ES6 模块导入时报 import is reserved 的解析器配置方案,提供 ecmaVersion 与 parserOptions 设置指南。
解决 esbuild 报错 React is not defined jsxFactory JSX 运行时失配修复
排查 使用 esbuild 构建 React/Preact 组件时控制台报 ReferenceError: React is not defined,分析 新旧 JSX 转换(classic vs automatic)与 jsxFactory / jsxFragment 配置。
解决 Pinia 报错 getActivePinia was called but there was no active Pinia 修复
排查 在 Vue 3 或 Nuxt 应用中在路由守卫、组件外部工具文件或 Pinia 注册前调用 useUserStore() 报错 getActivePinia() was called but there was no active Pinia,分析 Vue 插件注入顺序与 store 实例化上下文。
解决 Webpack 模块联邦 报错 ScriptExternalLoadError remoteEntry.js 加载失败修复
排查 微前端使用 Webpack 5 ModuleFederationPlugin 加载远端微应用时报 ScriptExternalLoadError: Loading script failed for remoteEntry.js,分析 跨域 CORS、publicPath 动态补全与资源 Hash 缓存失效。
解决 Webpack 报错 Module parse failed Unexpected token
分析 Webpack 在打包 JSX、TypeScript 或现代 CSS 时报 Module parse failed 的 Loader 规则缺失排查与配置方案。
解决 Zustand 报错 set is not a function 切片与中间件嵌套失效修复
排查 在 React 应用中使用 Zustand 的 create 函数拆分切片 Store 并结合 devtools 或 persist 中间件时报错 set is not a function,分析柯里化传参顺序与切片定义签名。
解决 Remix 报错 Nested route content not rendering <Outlet /> 缺失白屏修复
排查 Remix 访问子路由(如 /dashboard/analytics)时页面只显示父级侧边栏,子页面区域完全空白,分析 布局组件中 <Outlet /> 占位符缺失。
解决 TanStack Query 缓存淘汰竞争条件 staleTime 与 gcTime 失效修复
排查 在 React 应用中使用 TanStack Query (React Query) v5 时页面切换导致数据频繁闪烁、重复请求或被意外销毁,分析 staleTime 刷新策略与 gcTime 垃圾回收时间配置。
解决 模块联邦 报错 Shared module has multiple copies React 规则破坏修复
排查 模块联邦应用报 Warning: Invalid hook call. Hooks can only be called inside of the body of a function component,分析 React 单例共享配置(singleton: true)缺失与版本范围失配。
解决 SvelteKit 报错 Sequential load waterfalls 瀑布流网络卡顿修复
排查 SvelteKit 页面加载极慢耗时数秒,监控显示父子 layout 与 page 的 load() 串行发请求形成严重网络瀑布流,分析 Promise.all 并发优化。


