Hi, been attempting to build my next application to support older browsers - some of our code uses a spread for components. We're using the @babel/preset-react preset
In our next js config, we still error with Spread children are not supported in React. on build.
( It's erroring on a component with a usage like this: {...Components} )
I'm using webpack like the following in our nextjs config:
webpack(config) {
config.module.rules.push({
test: /\.(js|tsx|ts)$/i,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
'next/babel',
'@babel/preset-typescript',
'@babel/preset-react',
'@babel/preset-flow',
],
plugins: [
['@babel/plugin-transform-react-jsx'],
['@babel/plugin-proposal-optional-chaining'],
['@babel/plugin-transform-spread'],
],
},
},
});
If anyone has any expertise on webpack with this - that would be amazing