Continue publishing preact/compat as standalone node module also?
See original GitHub issueI’d like to suggest you continue publishing the npm package preact-compat
as alternative method of installing/using preact/compat
.
This would make it possible to use npm and yarn’s native package.json dependency renaming syntax and skip installing 3rd party aliasing-plugins and/or relying on bundler config tricks.
Like so…
npm install react@npm:preact-compat@^10 react-dom@npm:preact-compat@^10
resulting in these depdendency lines in package.json
"react": "npm:preact-compat@^10",
"react-dom": "npm:preact-compat@^10",
The only thing that might make this unfeasible, is if this would result in large amounts of code being imported twice - once from node_modules/react
and then again from node_modules/react-dom
.
I’m not familiar enough with the preact codebase to judge how tight the coupling is between the "react"y and "react-dom"y bits of Preact.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Switching to Preact (from React)
Switching to Preact can be as easy as installing and aliasing preact-compat in for react and react-dom . This lets you continue writing...
Read more >preact
Extensive React compatibility via a simple preact-compat alias; Everything you need: JSX, VDOM, React DevTools, HMR, SSR.. A highly optimized ...
Read more >Getting started with PreactJS — A Step By Step Guide
There are very small (and negligible) API difference between React and Preact when writing UI. Having said that, If you like to stay...
Read more >Build a Health Blog With Video Coaching Using Preact.js ...
Notably, it's only 3.5kb in size and is compatible with the React modules you would find on npm. Being able to write React/React...
Read more >API - esbuild
It can also be used to import code in node at run time from a package that ... This behavior improves compatibility with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Does npm aliases work for compat? At least when they were first introduced, it only aliased the package for yourself, not for any libraries you add (e.g. when your code imported
react
you would getpreact-compat
but if you usedreact-router
, it’sreact
import would still bereact
, not compat). That’s my understanding of the relevant section in the RFC (see the paragraph about problems this RFC does not address). Has npm changed the behavior of aliases since this RFC was released?@marvinhagemeister Thanks, I did notice that, no worry. I’m just posting my solution for the record, and comparing with what others are doing