You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
``When integrating React Leaflet into a Next.js application, the following error occurs during runtime:
SyntaxError: Named export 'use' not found. The requested module 'react' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'react';
const { createContext, use } = pkg;
This error happens when rendering the /map route that uses React Leaflet components. React, expected to provide named exports (e.g., useState, useEffect), is treated as a CommonJS module, causing the application to crash.
This error happens when rendering the /map route that uses React Leaflet components. React, expected to provide named exports (e.g., useState, useEffect), is treated as a CommonJS module, causing the application to crash.
Hello !
I had the exact same issue yesterday at work. And for me, the problem was : I reflexively installed the latest version of react-leaflet (so the 5), but it's only compatible with React 19, whereas our project is in React 18.
Hope it helps!
``When integrating React Leaflet into a Next.js application, the following error occurs during runtime:
SyntaxError: Named export 'use' not found. The requested module 'react' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'react';
const { createContext, use } = pkg;
This error happens when rendering the /map route that uses React Leaflet components. React, expected to provide named exports (e.g., useState, useEffect), is treated as a CommonJS module, causing the application to crash.
This error happens when rendering the /map route that uses React Leaflet components. React, expected to provide named exports (e.g., useState, useEffect), is treated as a CommonJS module, causing the application to crash.
The text was updated successfully, but these errors were encountered: