Formatjs / react-intl with Vite

2.7k views Asked by At

Formatjs provides a babel plugin for modules that use react-intl to inject message IDs and remove description. How can I use it with Vite?

1

There are 1 answers

0
Eld0w On

If you're using @vitejs/plugin-react, you can specify a .babelrc or a babel.config.js.

import React from '@vitejs/plugin-react'

...

plugins: [
  React({
    babel: {
      babelrc: true
    }
  }),

  ...

]

https://www.npmjs.com/package/@vitejs/plugin-react