-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
Deprecation warning when using import #190
Comments
Thanks for the report. This should only display if you're trying to get the deprecated |
|
So it will be renamed eventually, which is why it is deprecated. |
Same problem here. Is there anyway to get rid of the distracting 'deprecated' warning without forking and changing the source code? |
I haven't yet investigated what changes can be made to this module to fix the deprecation warning for the |
perhaps remove the deprecation warning until you have time to investigate further? |
The deprecation warning was added almost 5 years ago and there was no issue until this issue. Perhaps if this issue was opened closer to when it was added reverting would be considered, but whatever has changed since then isn't this module. |
My guess is that people are simply using the 'import' style more now. |
… using `esm` module. see expressjs#190
Here is a fix that leaves the deprecation message in place: #207 Note that |
Quick fix is to pass "tiny" instead of dev to morgan. |
@dougwilson I tried updating my app to use native ES modules now that they have landed in node (since node 13.2.0), but ran into some issues, so need to stick with |
This will do the trick |
To be clear, this issue is specific to using the Testing this with a basic import of |
I was hopeful, but turns out this doesn't work 😕 |
I did some additional research today with the |
This is enough to cause the warning for me: test.js: import morgan from 'morgan' node -r esm test.js As discussed here, the issue is that morgan has an export called |
same problem still! |
same problem yeah |
same problem so far.. |
Same thing... |
I got this problem. any solutions ? |
@craigcosmo It was solved by changing the import statement to require. |
yeah I tried that, and its fixed |
Hey guys! When you call morgan just try to do this: app.use(morgan("dev")); It worked for me, the "dev" is cause i use "npm run dev" (you can change it on package.json, instead of using "start", to start the server, hope i could be helpfull :D |
@RMERCADOR98 All that does is change to the formatting option named |
In other news, I am using Koa instead of Express in my latest server, so I used koa-morgan, so I'm not getting the warning anymore because the import is now indirect. Obviously this won't help those who want to use Express or httpServer and so are using |
@mbrowne I can confirm that this prevents the deprecation warning:
... but in typescript, it seems I now lose type information on the file. The following works, but only if
|
@dougwilson Every new comment is repeating what has been said before. Maybe you should lock the conversation until resolved. |
When using
import
with esm using morgan, I get the following warning message :This does not occur when using
require
.Example : https://repl.it/repls/SeagreenGrippingHexagon
On Morgan v1.9.1.
The text was updated successfully, but these errors were encountered: