How to use @babel/plugin-transform-react-constant-elements - 2 common examples

To help you get started, we’ve selected a few @babel/plugin-transform-react-constant-elements examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reworkjs / reworkjs / src / internals / babel / global-babel-preset.js View on Github external
regenerator: true,

        // https://github.com/webpack/webpack/issues/4039#issuecomment-273804003
        // we can't have both `import` and `module.exports` in the same file.
        // we can't
        useESModules: false,
        ...opts['@babel/plugin-transform-runtime'],
      }],
    ],
  };

  const env = process.env.BABEL_ENV || process.env.NODE_ENV;
  if (env === 'production') {
    preset.plugins.push(
      require('babel-plugin-lodash'),
      require('@babel/plugin-transform-react-constant-elements').default,
    );
  }

  return preset;
};
github instructure / instructure-ui / packages / ui-babel-preset / lib / index.js View on Github external
[require('@babel/plugin-proposal-object-rest-spread').default, { useBuiltIns: true }],
    require('@babel/plugin-proposal-optional-chaining').default,
    [require('@babel/plugin-transform-runtime').default, {
      ...babelHelperVersion,
      corejs: false,
      regenerator: true,
      helpers: true,
      useESModules: opts.esModules
    }],
    require('@babel/plugin-syntax-dynamic-import').default,
    require('babel-plugin-transform-undefined-to-void')
  ])

  if (process.env.NODE_ENV === 'production') {
    plugins.push(
      require('@babel/plugin-transform-react-constant-elements').default
    )
  }

  let themeableOptions = {
    postcssrc: loadConfig('postcss', require('@instructure/ui-postcss-config')()),
    themeablerc: loadConfig('themeable')
  }

  if (opts.themeable && typeof opts.themeable === 'object') {
    const { themeablerc, postcssrc } = opts.themeable
    if (themeablerc) {
      themeableOptions.themeablerc = themeablerc
    }
    if (postcssrc) {
      themeableOptions.postcssrc = postcssrc
    }

@babel/plugin-transform-react-constant-elements

Treat React JSX elements as value types and hoist them to the highest scope

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis

Popular @babel/plugin-transform-react-constant-elements functions