Run ndc codemod to improve next.js compatibility
See original GitHub issueI’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:
- Created 2 years ago
- Comments:10
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
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.