-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Problems when installing with latest NextJS #22
Comments
Have you found a temporary solution? @gergelypap 🤔 |
npm 7 changed the handling of peer dependecies to install them by default which will likely be issue here since many React-specific packages specify React as a peer dependency. My suggestions:
|
Same issue here, I'm on Next I've also tried this approach, and it doesn't work either. Anyone have a solution here? There seems to be huge blockers to getting preact to play nice with Next. |
So I just did an upgrade but without chaging the config, ie. did not include |
@onygami if you aren't including your config export with Just installing it with NPM is not going to make your app use Preact, that's the whole point of the |
Exactly that's what I thought, but then I built the project and my bundle size decreased by almost |
@onygami Thinking about this more, did you alias react in your If so, that would explain how it's using preact over react, despite not updating the next config! This obviously deviates from the documentation, but if it works... maybe this is the way to go? |
@ndimatteo Yeah, I deleted "dependencies": {
"react": "npm:@preact/[email protected]",
"react-dom": "npm:@preact/[email protected]",
"react-ssr-prepass": "npm:preact-ssr-prepass@^1.1.3"
} |
This is what worked for me:
(Updated to reflect comment below) |
(Just a side note, |
not installing |
use "dependencies": { |
Same problem here with yarn berry (v2).
Edit 1:
Maybe I should add a resolver in .yarnrc or somewhere? Edit 2:
|
With the latest version (10.2.1) and webpack5 enabled there is a new problem:
Both work well with webpack4. I'd suspect this line and maybe this change on the next.js side of things. |
@JoviDeCroock is this something you can look into? We briefly spoke about it already in the context of #25 that the latest version of next will bring some breaking changes with webpack 5, now that |
I'm going to try and take a look in the following days, will update the test-suite to use 10.2.1 if that doesn't surface the error I'll probably need some help reproducing |
Should be very straightforward to reproduce, for all of our repos we ran into the same issue with the update - also updated the example repo here: https://github.com/tbgse/preact-webpack5-next with the same problem. Let me know if you need more help to reproduce or test |
@JoviDeCroock Thanks a lot. I'm also offering support and would anything test as soon as you have a PR ready. |
next.js added a I think we can add
These are the possible formats:
The advanced syntax with more options has been added for webpack 5. See here for more info: https://webpack.js.org/configuration/entry-context/#entry-descriptor |
btw. if you want to inject an additional entry to all entrypoints you can do that: (only webpack 5) const dependency = EntryPlugin.createDependency('@prefresh/core', { name: 'prefresh entry' });
compiler.hooks.make.tapAsync("Plugin", (compilation, callback) => {
compilation.addEntry(compiler.context, dependency, undefined, callback);
}); |
@sokra thank you so much for your insight, managed to get it to work. That was really insightful, will apply that Fixed and published as 3.0.6 |
I recently experienced this issue on a fresh install of nextjs "react": "npm:@preact/[email protected]",
"react-dom": "npm:@preact/[email protected]", |
When I install the required packages, two problems happen.
First, the vulnerability fixes would introduce breaking changes.
After this, I update my
next.config.js
:When building the project, this happens:
Needless to say, these dependencies are already present. I honestly don't know what's happening. Tested with latest, FRESH install of NextJS.
My package dependencies:
UPDATE: Now I tried with these dependencies:
Deleted node_modules and package-lock.json, and
npm i
says:Versions and stuff:
The text was updated successfully, but these errors were encountered: