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.

"Experimental features" warning should be configurable via flag

See original GitHub issue

What version of Next.js are you using?

11.0 (but applies to all)

What version of Node.js are you using?

N/A

What browser are you using?

N/A

What operating system are you using?

N/A

How are you deploying your application?

N/A

Describe the Bug

If the next.config.js file contains a key named experimental, Next.js always prints a warning message on startup, like:

warn  - You have enabled experimental feature(s).
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use them at your own risk.

There is currently no way to disable this warning.

FWIW I searched the existing issues and discussions, and surprisingly did not see an issue covering this topic yet.

Expected Behavior

The warning should be configurable via some kind of an override flag in next.config.js, such as:

module.exports =  {
    experimental: {
      externalDir: true
    },
    // Potential new config flag:
    disableExperimentalFeaturesWarning: true
}

To Reproduce

  1. Create a new Next project
  2. Add a next.config.js file
  3. Add a field named experimental with any known experimental flag, per the Next docs

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:16
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
markeriksoncommented, Nov 4, 2021

I explicitly acknowledged that I was using an “experimental feature” when I wrote the key experimental in my config file.

I don’t need to be reminded of that every time the app starts up in both development and production builds.

On top of that, we use the next-page-tester library to do “integration”-style tests of an entire page route at a time… and every single test that loads a page is printing out these console warnings.

I was already hijacking console.log() to filter out some warnings in certain tests, including the ever-popular useLayoutEffect can’t be used in SSR” warning from React itself. I was partially successful in filtering out the “experimental” warning in tests as well.

But, from my perspective, it’s a useless message cluttering up my terminal, much akin to the “hundreds of packages have audit issues warnings” you wrote about recently. It’s irrelevant to my workflow, and it gets printed every time.

(On top of that, the particular “experimental” feature I just enabled is the externalDirs flag that was just suggested to me by Sokra specifically for my use case of importing files from other folders in the repo.)

2reactions
gaearoncommented, Nov 4, 2021

I’m curious, what’s the purpose of disabling the warning? From my perspective, the whole point of the warning is to make it impossible to start the app without an acknowledgement that you’re relying on prerelease features.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Experimental features in Firefox - Mozilla - MDN Web Docs
This page lists Firefox's experimental and partially implemented features, including those for proposed or cutting-edge web platform ...
Read more >
Enabling Experimental Features | Rancher Manager
Enable features when starting Rancher. When installing Rancher with a CLI, you can use a feature flag to enable a feature by default....
Read more >
Enabling Experimental Features - Rancher
In the data section, you will see an array containing all of the features that can be turned on with feature flags. The...
Read more >
About Eventing experimental features - Knative
Experimental features are unstable and may cause issues in your Knative setup or even your cluster setup. These features should be used with...
Read more >
Vagrant Experimental Feature Flag - HashiCorp Developer
Some features that aren't ready for release can be enabled through this feature flag. There are a couple of different ways of going...
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