Error occured when I use MRT's IconButtons to add IconButton on the right side of the Toolbar. #277
Answered
by
KevinVandy
dnjsgur0629
asked this question in
Q&A
-
I did the following to add an export Icon button on the right side of the Toolbar. <MaterialReactTable
...
renderToolbarInternalActions={({ table }) => (
<>
<MRT_ToggleGlobalFilterButton table={table} />
<MRT_ToggleFiltersButton table={table} />
<MRT_ShowHideColumnsButton table={table} />
<MRT_FullScreenToggleButton table={table} />
<BaseIconButton toolTip={'export'} onClick={handleExportData}>
<FileDownloadIcon />
</BaseIconButton>
</>
)}/> Then the following error occurred.
It seems to be a configuration issue because it works fine in codesandbox. Here are my config files. const withSvgr = require('@newhighsco/next-plugin-svgr')
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
const Dotenv = require('dotenv-webpack')
const withPlugins = require('next-compose-plugins')
const { patchWebpackConfig } = require('next-global-css')
const withInterceptStdout = require('next-intercept-stdout')
const nextConfig = {
transformIgnorePatterns: [`/node_modules/(?!${['react-icons'].join('|')})`],
eslint: {
ignoreDuringBuilds: true,
},
future: {
webpack5: true,
},
}
const webpackConfig = withBundleAnalyzer({
target: 'serverless',
distDir: '.next',
compress: true,
env: {
BASE_URL: process.env.BASE_URL,
},
webpack(config, options) {
const prod = process.env.NODE_ENV === 'production'
const plugins = [...config.plugins]
if (process.env.CYPRESS === 'true') {
//Allows importing the global.css file in cypress/support/component.tsx
patchWebpackConfig(config, options)
}
config.module.rules.push({
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: [
{
// Enable figma's wrong mask-type attribute work
removeRasterImages: false,
removeStyleElement: false,
removeUnknownsAndDefaults: false,
// Enable svgr's svg to fill the size
removeViewBox: false,
},
],
},
},
},
],
})
config.plugins.push(new Dotenv({ silent: true }))
// absolute path
config.resolve.modules.push(__dirname)
return {
...config,
mode: prod ? 'production' : 'development',
devtool: prod ? 'hidden-source-map' : 'eval',
plugins,
}
},
})
module.exports = withPlugins(
[
withInterceptStdout(
withSvgr({
reactStrictMode: true,
svgrOptions: {},
}),
(text) => (text.includes('Duplicate atom key') ? '' : text)
),
webpackConfig,
],
nextConfig
)
{
"compilerOptions": {
"target": "es2017",
"baseUrl": ".",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"incremental": true,
"types": ["cypress", "node"]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
{
"presets": [
"next/babel",
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
"@babel/preset-typescript"
],
"plugins": [
[
"styled-components",
{
"ssr": true
}
],
["@emotion"],
[
"babel-plugin-import",
{
"libraryName": "@material-ui/core",
"libraryDirectory": "",
"camel2DashComponentName": false
},
"core"
],
[
"babel-plugin-import",
{
"libraryName": "lodash",
"libraryDirectory": "",
"camel2DashComponentName": false
},
"lodash"
]
]
}
Sorry for the long code. I didn't know how to reproduce it with codeSandbox, so I imported my config files. |
Beta Was this translation helpful? Give feedback.
Answered by
KevinVandy
Dec 22, 2022
Replies: 1 comment 3 replies
-
What version of MUI are you using? |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
dnjsgur0629
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of MUI are you using?
And what version of MRT?