martpie / next-transpile-modules

Next.js plugin to transpile code from node_modules. Please see: https://github.com/martpie/next-transpile-modules/issues/291
MIT License
1.13k stars 85 forks source link

Unwanted deprecation warnings for next/head, next/router, and styled-jsx/server #208

Closed martpie closed 3 years ago

martpie commented 3 years ago

Some people are facing weird logs/warning like:

next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "next/head", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "next/router", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "styled-jsx/server", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.

This is definitely a bug, as those deps are not used to initialize next-transpile-modules.

I think those warnings can be ignored, and I will work on a fix as soon as I find the root of the issue.

martpie commented 3 years ago

To anyone facing this bug, I cannot reproduce it, can you please fill this information? https://github.com/martpie/next-transpile-modules/blob/master/.github/ISSUE_TEMPLATE/bug_report.md

It would greatly help 🙌

efeminella commented 3 years ago

I'm having the same issue. It's should be easy to reproduce by deleting yarn.lock, reinstalling dependencies, then starting next.

Are you trying to transpile a local package or an npm package? Local

If an npm package, which one? See warnings below, my project is not attempting to transpile any of the packages which are displayed in the warnings.

Describe the bug DEPRECATED - fallbacking to previous module resolution system for module "XXX", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.

To Reproduce Was debugging a somewhat unrelated issue (next-transpile-modules was throwing errors resolving a newly added monorepo package. After verifying all configurations, I deleted yarn.lock and ran a clean yarn install as a sanity check; after which starting next again resulted in the newly added package being resolved without issue, but instead there has been a flood of these console warnings (hundreds).

Expected behavior Modules should be resolved as they were, no deprecation warnings should be displayed.

Setup

Additional context Add any other context about the problem here.

I'm seeing the console continually flooded with DEPRECATION warnings:

next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "next/head", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "next/router", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "styled-jsx/server", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "@material-ui/icons/Close", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "@material-ui/icons/AccessTime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "@material-ui/icons/ChevronRight", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
event - compiled successfully
event - build page: /
wait  - compiling...
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "next/router", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
event - compiled successfully
event - build page: /404
wait  - compiling...
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
event - compiled successfully
event - build page: /login
wait  - compiling...
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "next/head", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module "react/jsx-dev-runtime", you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module.
event - compiled successfully
martpie commented 3 years ago

@efeminella this message was introduced in 7.1.0, are you using 7.1.0 or 7.1.1?

styxlab commented 3 years ago

I am seeing these messages with 7.1.1.

efeminella commented 3 years ago

@martpie - I am seeing this in both 7.1.0 and 7.1.1. Interestingly, a newly added local package can not be resolved in 7.0.0, but will resolve in 7.1.0 and 7.1.1, however, in both of the later, the next-transpile-modules - DEPRECATED - fallbacking to previous module resolution system for module message is displayed (though the newly added package resolves as expected. Any ideas as to a temporary work-around to omit or swallow these warnings?

Also, any thoughts as to why the newly added package would not resolve in 7.0.0 (it's simply a local package in our monorepo which is structured and configured exactly the same as all other packages)?

martpie commented 3 years ago

@efeminella Yes this is normal, 7.1.0 adds a new module resolution system that should help transpiling some modules that don't have a valid package.json by making assumptions on how the module file structure is. This is when I added the deprecation warning.

Refer to the changelog/releases page for more details: https://github.com/martpie/next-transpile-modules/releases

You can safely ignore these deprecation warnings, I will work on a fix, but I still cannot reproduce this issue on my setups, so please everyone seeing this, fill the issue template so I can have more information on your setup

martpie commented 3 years ago

Ok, I can reproduce it on a Webpack 4 setup, I will investigate this more in details.

martpie commented 3 years ago

Should be fixed in 7.1.2.

SimenB commented 3 years ago

Warning is gone, thanks!

martpie commented 3 years ago

Thank you for confirming! ✌️