title: Add craco webpack plugin by condition for create react app
body: <p>I am using <a href="https://github.com/gsoft-inc/craco" rel="nofollow noreferrer">craco</a> with create react app and I would like to add a plugin only in DEV mode  or by ENV Var</p>
  <p>my craco.config looks is:</p>
  <pre><code>const path = require('path');
  const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
  
  module.exports = () =&gt; {
    return {
      webpack: {
        alias: {
          environment: path.join(
            __dirname,
            'src',
            'environments',
            process.env.CLIENT_ENV || 'production'
          )
        }
        //   plugins: [new BundleAnalyzerPlugin()]
      },
      jest: {
        configure: {
          testPathIgnorePatterns: ['&lt;rootDir&gt;/src/environments/'],
          moduleNameMapper: {
            environment: '&lt;rootDir&gt;/src/environments/test'
          }
        }
      }
    };
  };
  </code></pre>
  <p>so I would like this BundleAnalyzerPlugin. only if the ENV param x =true or if NODE_ENV=test</p>
  <p>while I trying to push to plugin array I got that plugin I undefined</p>
  <pre><code>module.exports.webpack.plugins.push(plugin)
  </code></pre>