小编Viv*_*hik的帖子

未捕获的类型错误:无法读取未定义的属性(读取“__H”)

我正在尝试使用Preact + Vite + Typescript + Redux构建一个简单的 Todo 应用程序。但我面临着 redux 和 typescript 的一些兼容性问题。

这是我收到的错误。

Uncaught TypeError: Cannot read properties of undefined (reading '__H')
    at m (react-redux.064eb876.js:3)
    at d (react-redux.064eb876.js:3)
    at d.Provider [as constructor] (react-redux.064eb876.js:1165)
    at d.L [as render] (index.js:506)
    at $ (index.js:178)
    at m (children.js:147)
    at $ (index.js:195)
    at m (children.js:147)
    at $ (index.js:195)
    at M (render.js:36)
Run Code Online (Sandbox Code Playgroud)

我在 vite.config.ts 中将react&react-dom别名为preact-compat

export default defineConfig(
  {
  esbuild: {
    jsxFactory: 'h',
    jsxFragment: 'Fragment',
  },
  alias:
    [
       {find: 'react', …
Run Code Online (Sandbox Code Playgroud)

typescript react-redux preact vite

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

preact ×1

react-redux ×1

typescript ×1

vite ×1