Next.js: NextJS with React-Intl

Created on 7 Jun 2017  路  8Comments  路  Source: vercel/next.js

Hi, When running next.js with react-intl in Safari in example https://github.com/zeit/next.js/tree/v3-beta/examples/with-react-intl i see error:

Development:

dev

Production:

production

Chrome and Firefox is ok.

example

Most helpful comment

All 8 comments

馃憖 Keeping my on this because I'll introduce react-intl soon to my project.
So would be nice to see this discussion

Which version of Safari are you using? I think until 10 they didn't had the Intl API, so you need to use a polyfill (I use polyfill.io)

Thanks @coluccini . 馃憤

My Safari version: Version 9.1.2 (11601.7.7) and you right :)

@lucasfeliciano You can try this solution:

I try to change https://github.com/zeit/next.js/blob/v3-beta/examples/with-react-intl/components/Layout.js follow code and It work for me:

export default injectIntl(({intl, title, children}) => {
  const polyfillURL = 'https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.' + intl.locale;
  return (    
  <div>
    <Head>
      <meta name='viewport' content='width=device-width, initial-scale=1' />
      <title>{title || intl.formatMessage(messages.title)}</title>
      <script src={polyfillURL}></script>
    </Head>

    <header>
      <Nav />
    </header>

    {children}

  </div>
)
})

:+1: You can add it in /pages/_document.js as well.

If this works, could you please send a pull request for it, then everyone has the fix 鉂わ笍

Thank you team!

I got the same error when trying to use outdated IE10 after applying this solution. (By IE11's debug bar on Windows10)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renatorib picture renatorib  路  3Comments

timneutkens picture timneutkens  路  3Comments

knipferrc picture knipferrc  路  3Comments

flybayer picture flybayer  路  3Comments

kenji4569 picture kenji4569  路  3Comments