-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MUI-Datagrid] Uncaught ReferenceError: returntrue is not defined while using webpack #4490
Comments
Hi @nikossoftwaredev, I'm faced with the same issue, any ideas? |
Best I can tell, it occurs at EDIT:
|
Hey @nikossoftwaredev |
Rolled back to 5.8.0 and it works! Thanks |
Is there a workaround for this that doesn't involve rolling back webpack? It sucks that I can't use data grid if I'm on major version 4 of MUI :/ |
Hey @robolivable |
Duplicates
Latest version
Current behavior 馃槸
I am using
Whenever I go to a page that renders Datagrid i get this error
Expected behavior 馃
Not to crash the page
Steps to reproduce 馃暪
my webpack config
webpack version ^5.72.0
`
const ForkTsCheckerNotifierWebpackPlugin = require('fork-ts-checker-notifier-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const dotenv = require('dotenv');
const webpack = require('webpack');
const path = require('path');
const CompressionPlugin = require('compression-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
dotenv.config();
// style files regexes
const cssRegex = /.css$/;
const sassRegex = /.(scss|sass)$/;
const smp = new SpeedMeasurePlugin();
module.exports = (env, argv) => {
const isDev = argv.mode === 'development';
const isProd = argv.mode === 'production';
// common function to get style loaders
const getStyleLoaders = () => {
const loaders = [
isDev && require.resolve('style-loader'),
isProd && {
loader: MiniCssExtractPlugin.loader,
// css is located in
static/css
, use '../../' to locate index.html folder// in production
paths.publicUrlOrPath
can be a relative pathoptions: { publicPath: '../../' }
},
{
loader: require.resolve('css-loader'),
options: {
url: false
}
}
// {
// loader: 'postcss-loader',
// options: {
// postcssOptions: {
// plugins: [['postcss-preset-env']]
// }
// }
// }
].filter(Boolean);
};
const devPlugins = [
new webpack.DefinePlugin({
'process.env': JSON.stringify(process.env)
}),
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
}),
new HtmlWebpackPlugin({
inject: true,
template: './public/index.html',
filename: './index.html',
favicon: './public/favicon.ico'
}),
new ForkTsCheckerWebpackPlugin({
formatter: 'codeframe'
}),
new ForkTsCheckerNotifierWebpackPlugin({ title: 'TypeScript', excludeWarnings: false }),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: '[name].css',
chunkFilename: '[id].css'
})
];
const prodPlugins = [
new CopyPlugin({
patterns: [{ from: path.resolve(__dirname, 'public/'), to: './build' }]
}),
new CompressionPlugin(),
new webpack.DefinePlugin({
'process.env': JSON.stringify(process.env)
}),
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
}),
new webpack.optimize.SplitChunksPlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new HtmlWebpackPlugin({
inject: true,
template: './public/index.html',
filename: './index.html',
favicon: './public/favicon.ico'
}),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: '[name].css',
chunkFilename: '[id].css'
})
];
const devServer = {
open: true,
historyApiFallback: true,
compress: true,
port: 3000,
liveReload: true,
watchFiles: ['src/**/*'],
client: {
overlay: true
},
static: {
directory: path.join(__dirname, 'public')
}
};
return smp.wrap({
context: process.cwd(), // to automatically find tsconfig.json
plugins: isDev ? devPlugins : prodPlugins,
...(isDev ? { devtool: 'inline-source-map' } : {}),
...(isDev ? { devServer } : {}),
entry: './src/index.tsx',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'index.js',
publicPath: '/'
},
module: {
rules: [
{
test: /.(js|jsx)$/,
exclude: /node_modules/,
include: path.resolve(__dirname, 'src'),
use: {
loader: 'babel-loader'
}
},
{
test: /.tsx?$/,
exclude: /node_modules/,
include: path.resolve(__dirname, 'src'),
use: [{ loader: 'ts-loader', options: { transpileOnly: true } }]
},
{
test: cssRegex,
use: getStyleLoaders({
importLoaders: 1
}),
// Don't consider CSS imports dead code even if the
// containing package claims to have no side effects.
// Remove this when webpack adds a warning or an error for this.
// See https://github.com/webpack/webpack/issues/6571
sideEffects: true
},
{
test: /.s[ac]ss$/i,
use: [
// fallback to style-loader in development
isDev ? 'style-loader' : MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
},
{
test: /.(png|jpe?g|gif|svg)$/i,
exclude: [/.(js|mjs|jsx|ts|tsx)$/, /.html$/, /.json$/],
use: [
{
loader: 'file-loader'
},
{
loader: 'url-loader'
}
]
},
{
test: /.m?js/,
resolve: {
fullySpecified: false
}
}
]
},
resolve: {
extensions: ['.mjs', '.tsx', '.ts', '.js', '.jsx', '.css', '.scss', '.json'],
modules: [path.resolve(__dirname, './src'), 'node_modules'],
alias: {
'@crema': path.resolve(__dirname, './src/@crema'),
api: path.resolve(__dirname, './src/api'),
modules: path.resolve(__dirname, './src/modules'),
shared: path.resolve(__dirname, './src/shared'),
styles: path.resolve(__dirname, './src/styles'),
types: path.resolve(__dirname, './src/types')
},
// Mqtt package uses buffer, wee need to see if we can change it
fallback: { buffer: require.resolve('buffer') }
}
});
};
`
Context 馃敠
No response
Your environment 馃寧
`npx @mui/envinfo`
Order ID 馃挸 (optional)
No response
The text was updated successfully, but these errors were encountered: