preactjs / preact-compat

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

Dont' work with git version of preact #469

Closed koutsenko closed 6 years ago

koutsenko commented 6 years ago

I've installed latest preact version npm install git+https://github.com/developit/preact.git

It installs successfully, but when i try to build project, i get an error:

ERROR in ./node_modules/preact-compat/dist/preact-compat.es.js Module not found: Error: Can't resolve 'preact' in 'C:******\node_modules\preact-compat\dist'

marvinhagemeister commented 6 years ago

Most npm packages are precompiled/minified/etc before the final package is created and published on npm. The git dependency feature of npm is only intended for packages which do not have this build step, which preact does have.

koutsenko commented 6 years ago

Thanks for the comment, Marvin. Is there any way to get preact with working HMR today? Latest published 1.2.7 version doesn’t work with it.

marvinhagemeister commented 6 years ago

@koutsenko If there isn't already an open issue with HMR feel free to file a new one with steps to reproduce the problem you are experiencing.

koutsenko commented 6 years ago

Marvin, it just dont't work. I already saw that it wouldn't . Is there any "supported & unsupported features" table for preact? Now, I should discover it yourself...

marvinhagemeister commented 6 years ago

HMR is implemented by third party libraries like react-hot-loader not by frameworks themselves (eg react/preact/whatever). Best to file an issue on their repository.

Although we do try to support as much of the react ecosystem as we can, we can't keep track of any change done in a third party library. That's why such a list would not make sense because it would always be out of date with the rate of changes coming each day.

kevlened commented 6 years ago

I'm using https://github.com/developit/preact-cli with the https://github.com/preactjs-templates/material template and HMR works. Try comparing your setup to that one.

developit commented 6 years ago

I believe there are already multiple issues open about HMR. React Hot Loader is (was?) assuming module boundaries were mutable, which isn't the case if you're using an ES Modules bundler like Rollup or Webpack 4. That issue has little/nothing to do with Preact, and more to do with RHL.