Closed zephraph closed 4 years ago
This pull request is being automatically deployed with Vercel (learn more). To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/developit/nextjs-preact-demo/mxwwgiz1r ✅ Preview: https://nextjs-preact-demo-git-fork-zephraph-patch-1.developit.now.sh
Hi @zephraph - the package.json alias is only applied to code that doesn't specify an incompatible React version range. If you install an npm dependency that includes {"peerDependencies":{"react":"^16"}}
, it will end up bundling a copy of React 16 into your JS. The Webpack alias fixes this, by forcing all "react"
and "react-dom"
dependencies to be remapped to top-level version that is aliased to preact/compat
.
Oh! TIL. Thanks for the tip.
Given the
package.json
trick that usespreact-compat/react-dom
this alias isn't required.