-
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
Compiling with Warnings #10633
Comments
So I noticed that this only happens with |
Sounds expected, it means you're importing a library that uses expression requires. Warning can be ignored just fine. eg the dep will have something like this:
|
In the future please add a complete reproduction otherwise it's impossible for us to help you in a way that is productive. |
@timneutkens Not sure if this was addressed through some other issue, but if repro steps are needed to reopen this, I can repro this with nothing but the starter template (which pulls Repro steps:
module.exports = {
target: 'serverless',
}
Result is:Console output
Additional info:I've been downgrading Next to see if I can see when this started happening, and I've observed that
Unless this is expected from Next itself by default, it does not seem like a user added dependency is causing this, considering it can be reproed with the starter template? Hopefully it's useful. |
Shouldn't this be reopened? I'm experiencing this issue as well. |
My impression after reading the comments here is that building Next with As someone who is looking into the possibility of deploying a Next app to AWS while still profiting from most of the benefits the framework offers, I am mainly interested in whether or not it is safe to ignore these warnings or if something might actually break in certain situations. |
We're definitely using Next.js with Serverless, via https://github.com/danielcondemarin/serverless-next.js |
As said there is nothing to "fix" here, it's a warning that a certain file could not be bundled as per #10633 (comment). So it was treated as external by webpack. |
@timneutkens Cheers for the reply. With reference to that comment, I believe the wording of it is what caused the misunderstanding here. I believe the reason we all continued to comment here is because that comment reads like: "You caused this, because you're doing this" I understand what the warning is, however, with the above said I assumed you might not be expecting this to happen with a clean installation. Hopefully we can agree that it's a bit unexpected for Next.js to present you with lengthy warnings you can't get rid of, by flipping the switch to Which is why I provided a clean repro and asked:
Your reply now, while it doesn't explicitly address if this should be expected or not by default, the only thing I can do is assume in good faith that it is. Hopefully that clarifies my intent a bit. Apologies for wasting your time. |
@timneutkens If the end-user receives a warning, that implies the end-user should fix it. Similarly, if Next expects webpack to treat some files as externals, then Next shouldn't output the warnings. Because the convention is not to warn for expected behavior. Imagine if |
The serverless target as-is is not ideal in many cases, eg it bundles dependencies that are hard to bundle, hence why we started working on a new target called serverless-trace which does not bundle node_modules anymore and as such does not show this type of warning (as it literally does not bundle the deps that cause it).
npm is a bad example to make that point given that it shows a ton of non-actionable warnings and messages always. In this case the warning (shown by webpack) is relaying that it's ignoring a certain file's dynamic require. It's more-so an information message but we currently just output webpack errors and warnings as-is. |
I am getting this when I created a dynamic function for importing.
|
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
When building the project locally and on Now I'm getting these warnings:
To Reproduce
1- Have a simple next.js app and try build
Expected behavior
No warnings
Screenshots
If applicable, add screenshots to help explain your problem.
System information
The text was updated successfully, but these errors were encountered: