preactjs / preact-compat

ATTENTION: The React compatibility layer for Preact has moved to the main preact repo.
http://npm.im/preact-compat
MIT License
950 stars 148 forks source link

preact-compat crashes when trying to migrate react functions + hooks to preact #536

Closed vtcaregorodtcev closed 4 years ago

vtcaregorodtcev commented 4 years ago

Have application written in react using only react functions and hooks somewhere (useState, useEffect only). Follow preact migration where I see, "I need to add only two lines" aliases for react and react-dom in my webpack config.

after those manipulations I get error:

Uncaught TypeError: Cannot read property 'prototype' of undefined
    at eval (preact-compat.es.js:80)
    at Module../node_modules/preact-compat/dist/preact-compat.es.js (main.js:11604)
    at __webpack_require__ (main.js:727)
    at fn (main.js:101)
    at eval (index.jsx:2)
    at Module../src/index.jsx (main.js:16111)
    at __webpack_require__ (main.js:727)
    at fn (main.js:101)
    at eval (webpack:///multi_(:8080/webpack)-dev-server/client?:3:18)
    at Object.0 (main.js:16194)

error at VNode.prototype.$$typeof = REACT_ELEMENT_TYPE;

trying to migrate this project https://github.com/vtcaregorodtcev/fuckts-maps/tree/use-preact

can someone help me with that? where I should dig? is it trouble with preact-compat or with antd or react-draggable which I use in it?

Снимок экрана 2019-11-18 в 23 03 27
Kanaye commented 4 years ago

It looks like you are using preact@10 with preact-compat. Compat has been integrated into the preact main package. Change your alias from preact-compat to point to preact/compat and uninstall preact-compat just to be sure. If you encounter other issues after that change please report them at the main preact repo.

marvinhagemeister commented 4 years ago

@Kanaye summed it up perfectly :+1: You need to switch to preact/compat for Preact 10 :+1:

emilastanov commented 3 years ago

Awesome