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

To help you get started, we’ve selected a few @lingui/babel-plugin-transform-react 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 lingui / js-lingui / packages / babel-preset-react / index.js View on Github external
var transformJs = require("@lingui/babel-plugin-transform-js").default
var transformReact = require("@lingui/babel-plugin-transform-react").default

module.exports = function(context, opts) {
  return {
    plugins: [transformJs, transformReact]
  }
}
github lingui / js-lingui / packages / macro / src / index.js View on Github external
function macro({ references, state, babel }) {
  const { types: t } = babel

  const transformer = makeJsTransformer(babel)
  const jsxTransformer = new JSXTransformer(babel)
  const reactImportsToCarryOver = ["DateFormat", "NumberFormat"]
  const reactImports = []

  Object.keys(references).forEach(tagName => {
    const tags = references[tagName]
    const macroType = getMacroType(tagName)

    if (macroType === "jsx") {
      if (!reactImports.includes("Trans")) {
        reactImports.push("Trans")
      }

      if (reactImportsToCarryOver.includes(tagName)) {
        reactImports.push(tagName)
      }

@lingui/babel-plugin-transform-react

Transform React components to ICU message format

MIT
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis