Unverified Commit b516c4ea authored by Jon Espen Kvisler's avatar Jon Espen Kvisler Committed by GitHub

Transpile packages in react-intl example (#11849)

parent 6739ea39
...@@ -71,3 +71,7 @@ global.DOMParser = DOMParser ...@@ -71,3 +71,7 @@ global.DOMParser = DOMParser
``` ```
[react intl]: https://github.com/yahoo/react-intl [react intl]: https://github.com/yahoo/react-intl
### Transpile react-intl
According to [react-intl docs](https://github.com/formatjs/react-intl/blob/53f2c826c7b1e50ad37215ce46b5e1c6f5d142cc/docs/Getting-Started.md#esm-build), react-intl and its underlying libraries must be transpiled to support older browsers (eg IE11). This is done by [next-transpile-modules](https://www.npmjs.com/package/next-transpile-modules) in next.config.js.
const withTM = require('next-transpile-modules')([
'@formatjs/intl-relativetimeformat',
'@formatjs/intl-utils',
'react-intl',
'intl-format-cache',
'intl-messageformat-parser',
'intl-messageformat',
])
module.exports = withTM()
...@@ -21,5 +21,8 @@ ...@@ -21,5 +21,8 @@
"react-dom": "^16.9.0", "react-dom": "^16.9.0",
"react-intl": "^3.1.12" "react-intl": "^3.1.12"
}, },
"license": "ISC" "license": "ISC",
"devDependencies": {
"next-transpile-modules": "^3.2.0"
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment