title: api.targets is not a function in plugin-proposal-object-rest-spread
body: <p>I have this error when I try to compile my app. The error comes from <code>babel-plugin-proposal-object-rest-spread</code> here <a href="https://github.com/babel/babel/blob/6e551ae8827d064680c1344074db9fb3093967e9/packages/babel-plugin-proposal-object-rest-spread/src/index.js#L22" rel="nofollow noreferrer">https://github.com/babel/babel/blob/6e551ae8827d064680c1344074db9fb3093967e9/packages/babel-plugin-proposal-object-rest-spread/src/index.js#L22</a> :</p>
  <blockquote>
  <p>Trace: error TypeError: api.targets is not a function
  |     at /home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/preset-env/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js:38:25
  |     at /home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/preset-env/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
  |     at /home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/core/lib/config/full.js:166:14
  |     at cachedFunction (/home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/core/lib/config/caching.js:32:19)
  |     at loadPluginDescriptor (/home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/core/lib/config/full.js:201:28)
  |     at /home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/core/lib/config/full.js:71:20</p>
  </blockquote>
  <p>My <code>babel.config.json</code> is like this:</p>
  <pre><code>{
    &quot;plugins&quot;: [
      &quot;emotion&quot;,
      &quot;macros&quot;,
      &quot;@babel/plugin-proposal-class-properties&quot;
    ],
    &quot;presets&quot;: [&quot;next/babel&quot;],
    &quot;env&quot;: {
      &quot;test&quot;: {
        &quot;plugins&quot;: [&quot;require-context-hook&quot;]
      }
    }
  }
  
  </code></pre>
  <p>Does anyone has an idea? Thank you</p>