Comments (8)
For now, I've dealt with this by adding it to transpilePackages
in my Next.js app:
next.config.js
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
transpilePackages: ['@mui/x-charts'],
};
from mui-x.
I faced the same problem with Next.js's Material UI starter example (the most used one).
Error: require() of ES Module /Users/oliviertassinari/nextjs-with-typescript/node_modules/d3-shape/src/index.js from /Users/oliviertassinari/nextjs-with-typescript/node_modules/@mui/x-charts/BarChart/formatter.js not supported.
#9826 (comment) 's workaround did the trick.
from mui-x.
@alexfauquette This might be coming from the main
entry point https://unpkg.com/browse/@mui/[email protected]/context/CartesianContextProvider.js
from mui-x.
Yes, but the export
of the package.json
should import those files from https://unpkg.com/browse/@mui/[email protected]/esm/context/CartesianContextProvider.js which does not have this issue 🤔
"exports": {
".": {
"require": "./index.js",
"import": "./esm/index.js"
},
"./*": {
"require": "./*",
"import": "./esm/*"
}
},
from mui-x.
Did you also had to transpile the d3-*
libraries?
from mui-x.
No (at least I did not need to include them in the list). I'm unsure on whether it's done for dependencies automatically or not.
from mui-x.
Updated to @mui/[email protected]
, tried removing charts from transpilePackages
, now when importing charts like this:
import { PieChart } from "@mui/x-charts";
I get
Error: Cannot find module /home/project/node_modules/@mui/x-charts/PieChart'
at createEsmNotFoundErr (node:internal/modules/cjs/loader:1096:15)
at finalizeEsmResolution (node:internal/modules/cjs/loader:1089:15)
.
Adding modularizeImports
(like I already do with @mui/material):
modularizeImports: {
"@mui/material": {
transform: "@mui/material/{{member}}"
},
...
"@mui/x-charts": {
transform: "@mui/x-charts/{{member}}"
}
},
Gives me the same error but with a bunch of
Attempted import error: '@mui/x-charts/BarChart' does not contain a default export (imported as 'BarChart').
So for now, I'm leaving charts in transpilePackages
, and out of modularizeImports
.
from mui-x.
@oliviertassinari What version of Next were you using?
from mui-x.
Related Issues (20)
- [datagrid] Refactor: make all selectors accept the same argument
- [DatePicker] `minDate` in DatePicker props enabling dates earlier than specified HOT 6
- [data grid] Resizing doesn't work, even do not have separators between header column by default
- [pickers] Sustainable public API for customization
- [pickers] Allow to select the full date for easy copy-paste HOT 3
- [pickers] Add support for date-fns 3.0 HOT 29
- [DataGrid] Is there a way to open DataGrid in full screen mode? HOT 6
- [DataGrid] capture `onKeyDown` for the filters and header filters HOT 6
- [DataGrid] Pinning group by column with leafField results in incorrect behaviour HOT 4
- [docs] Compatibility version
- [pickers] Is it possible to use pickers in .ASP net website .aspx pages? HOT 2
- [DataGrid] `renderCell` params do not include row values anymore HOT 4
- `hasEval` detection leads to CSP warnings and reports HOT 6
- [core] Security issues with cherry-pick-next-to-master.yml
- [pickers] Problems after update to date-fns 3.0.1 HOT 3
- [DataGrid] Add recipe for pinning the grouped column
- [DataGrid] Maximum Call Stack Size exceeded for `createSelectorMemoized` HOT 10
- [charts] The tooltip should get a position option
- I have the following order, when will I be able to download my license key? HOT 1
- [data grid] valueFormatter doesn't show the updated value after processRowUpdate HOT 19
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mui-x.