question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The `querystring` API is considered Legacy. New code should use the `URLSearchParams` API instead.

See original GitHub issue

What version of Next.js are you using?

Latest

What version of Node.js are you using?

v14.15.0

Describe the Bug

When I create a new Next.js app using the following command:

npx create-next-app@latest

After following the steps and creating a new Next.js project, I get the following npm warnings:

npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

And from the querystring npm page:

The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

From MDN:

The URLSearchParams interface defines utility methods to work with the query string of a URL.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:11
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Ryz0ndcommented, Jul 26, 2021

Check this link! https://github.com/GoogleChromeLabs/native-url/issues/7

The main reason for not using URLSearchParams is because it’s not supported in Edge 16. Since Edge 16 supports type=module scripts our polyfilling technique would not work. So I’m not sure how we can polyfill URLSearchParams for all nomodule browsers + Edge 16 without doing something more complicated like reading the user-agent.

2reactions
dapinto8commented, Aug 5, 2021

Check this link! GoogleChromeLabs/native-url#7

The main reason for not using URLSearchParams is because it’s not supported in Edge 16. Since Edge 16 supports type=module scripts our polyfilling technique would not work. So I’m not sure how we can polyfill URLSearchParams for all nomodule browsers + Edge 16 without doing something more complicated like reading the user-agent.

It seems Edge 17 has support https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams https://caniuse.com/urlsearchparams

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to migrate from querystring to URLSearchParams in ...
querystring is a legacy Node.js API that shouldn't be used anymore. New code should only use URLSearchParams, which is part of WHATWG URL ......
Read more >
React npm warn deprecates how to deal with it?
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm WARN ...
Read more >
querystring dependency is deprecated · Issue #3862 - GitHub
npm WARN deprecated querystring@0.2.0 : The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
Read more >
Query string | Node.js v19.3.0 Documentation
Source Code: lib/querystring.js. The node:querystring module provides utilities for parsing and formatting URL query strings. It can be accessed using:
Read more >
Could you provide code using <URLSearchParams>? //The ...
Could you provide code using <URLSearchParams>? //The querystring API is considered Legacy. const params = new URLSearchParams({ APPID: api.key, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found