-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React Alias #1564
Comments
Okay. That's something we need to investigate. |
IMO, the |
+1 this seems to break Now deployments where an alias is set up (i've tested with Preact) |
$ npm run dev
> [email protected] dev E:\repo\next.js\examples\using-preact
> node server.js
module.js:472
throw err;
^
Error: Cannot find module 'react'
at Function.Module._resolveFilename (module.js:470:15)
|
Here is what I see when I use
The I see this same picture with Next.js 3.0.0-beta6, 2.4.0, 2.3.1, 2.2.0, 2.1.1. Next.js 2.0.1 produces a slightly smaller bundle (96kb):
The bundle size difference between Next.js 2.0.1 and the rest looks odd to me because the reports are almost identical (the I haven't found any Next.js version which would produce the bundle of less than 96kb (I went down to Next.js 2.0.0-beta32, which produced common.js (73kb) + main.js (60kb), so 133kb total). Other catches:
|
@arunoda do you think something can be done about this? Considering the performance improvement it would be great to switch to preact but it looks like the |
Just ran into the same issue. Any news / workaround (that doesn't increase bundle size) on this? |
We've remove this with Next.js 3.0. |
Tried this out with the current beta
For my specific needs React itself cannot be included in the project at all, so I'm trying to avoid it even if its just for build processes. |
@jeremiecarlson For this you need to wait for this to be loaded: #2659 Or you add custom React only in the production mode. I guess in that way, you won't see the ^^^ issue. |
Sorry, I seem to be a nag... 😞
I'm not sure at what point it was, but the latest few
beta
releases (and current2.0
release 🎉) lost the ability to fully alias React.Even with a
next.config.js
fully configured for aliasing React to Preact or Inferno, thereact
andreact-dom
still need to be installed, or else an error is thrown instantly. Not all that reassuring to begin with.After installing those two, the final bundle (
.next/commons.js
in beta,.next/app.js
in 2.0) is over 100kb. I recognize this to be larger than what theusing-{preact|inferno}
examples produced in the past.So, suspiciously, I combed through the output code and, sure enough,
preact
,preact-compat
andreact
are all there.I tested with Preact, but Inferno would operate exactly the same.
For combing, search for
expected a ReactNode
. Neither of the "compat" packages include this error message.The text was updated successfully, but these errors were encountered: