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.

Run ndc codemod to improve next.js compatibility

See original GitHub issue

I’m submitting a…

  • bug
  • feature
  • chore

What is the current behavior

I am using react-fincancial-charts in next.js, and the compiler raises warnings about the anonymous function exports from the react-financial-charts files, e.g.

../../node_modules/@react-financial-charts/indicators/lib/indicator/tma.js
Anonymous function declarations cause Fast Refresh to not preserve local component state.
Please add a name to your function, for example:

Before
export default function () { /* ... */ }

After
export default function Named() { /* ... */ }

A codemod is available to fix the most common cases: https://nextjs.link/codemod-ndc

What is the expected behavior

Named default exports would improve the compatibility of the library with next.js applications.

Please tell us about your environment

  • Version: 1.3.0
  • Compiler: next.js (webpack + tsc)

Other information

The codemod would solve the problem by assigning a generated name (based on the filename) to all default exports that were previously anonymous.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
markmcdowellcommented, Jun 5, 2021

Hi no it’s the other way around, you need Babel to support older versions of JavaScript. Next.js doesn’t support es modules out of the box

note we target es2017 in our typescript config

0reactions
stale[bot]commented, Jul 8, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Features: Codemods | Next.js
js provides Codemod transformations to help upgrade your Next.js codebase when a feature is deprecated. Codemods are transformations that run on your codebase ......
Read more >
codemod transformations to help upgrade Next.js codebases
codemod transformations to help upgrade Next.js codebases - GitHub - vercel/next-codemod: codemod transformations to help upgrade Next.js codebases.
Read more >
What's New in Next.js 13 - AppSignal Blog
What better way to check out what's new than by building a simple app, right? Jump-start a new Next.js 13 project with this...
Read more >
Exploring Next.js 11: What Is New - Telerik
Create React App Migration ( @next/codemod ); Support for webpack 5; Next.js Live. Without further ado, let's explore. Improved Performance. One ...
Read more >
Best practices to increase the speed for Next.js apps
Using server-side rendering will help your app reduce the time required to render the first page on the client side, so the user...
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