-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Cannot alias React #532
Comments
@lukeed Yep you are correct. common.js has React itself and main.js has preact. I really like the solution 1 you suggested.
I think this is something we could do. We just need to let babel to parse our next's public API as well. |
I tried it now and we may don't need to change any core setup at all. |
@arunoda Your PR does not work. While React is now missing from the Edit It works; the Preact example is functional. That was never the problem. But in terms of this Issue, fully removing/aliasing React is still broken. |
What do you mean by this? |
Preact is inside So when I load |
Did you check the production source code? To my check React was not in either files. |
Yup. I built your PR example |
Could you tell me how you identify React in your build? |
I cleared cache & rebuilt; and it wasn't there 😄 Thanks for taking care of this 👍 Now I have to investigate if |
After #222 & using the latest
master
branch (2.0.0-beta.3
) it's impossible to fully omit React from the next bundles.Using this
next.config.js
:In doing so, the
commons.js
output contains all Next.js pre-built code, including React. It also containspreact
andpreact-compat
. Having both React & Preact within the same bundle makes the alias redundant and pointless.Possible Solutions
Ship Next.js without the
dist
folder. Instead, build the library withinnext build
before building the application code. This will also require that the newbuild
process adheres to the samenext.config.js
configuration (user + defaults) all throughout.Add a
jsnext:main
entry with a myriad of moduleimport
/export
statements so that we may bypass the pre-builts & handle the build process ourselves (above).Both venture further into "userland", but they're also both completely opt-in. The unaware / unwanting dev should not & will not be affected.
Also, I thought this was the promise of #222 until I saw that my bundles fattened. For a second, t'was comforting to know that it wasn't just me over the holidays...
The text was updated successfully, but these errors were encountered: