Next.js: React-Intl example isn't working on IE11 (syntax error)

Created on 19 Mar 2020  路  2Comments  路  Source: vercel/next.js

Bug report

Describe the bug

with-react-intl example isn't working on IE11

To Reproduce

  1. Clone the example
  2. install, npm run dev
  3. open app in IE11

Expected behavior

Should add the polyfill for React-Intl on IE11
_react-intl, intl-messageformat, intl-messageformat-parser_

Screenshots

image
image

System information

  • OS: [Windows]
  • Browser: IE11
  • Version of Next.js: [lastest]
  • Version of React-Intl: v3 (from 3.1.2 to 3.7.0)

Most helpful comment

Any third party modules you import, you must transpile them if you need them to be valid ES5 syntax:

next.config.js:

module.exports = {
  webpack: (config, { defaultLoaders }) => {
    const filesToTranspile = ['react-intl'];
    config.module.rules.push({
      test: /\.(js|jsx)$/,
      include: file => {
        const re = new RegExp(`node_modules/((${filesToTranspile.join('|')})/).*`);
        return re.test(file);
      },
      use: [defaultLoaders.babel],
    });

    return config;
  },
}

There is a feature request for Next to build some of this functionality in: https://github.com/zeit/next.js/issues/706

All 2 comments

Any third party modules you import, you must transpile them if you need them to be valid ES5 syntax:

next.config.js:

module.exports = {
  webpack: (config, { defaultLoaders }) => {
    const filesToTranspile = ['react-intl'];
    config.module.rules.push({
      test: /\.(js|jsx)$/,
      include: file => {
        const re = new RegExp(`node_modules/((${filesToTranspile.join('|')})/).*`);
        return re.test(file);
      },
      use: [defaultLoaders.babel],
    });

    return config;
  },
}

There is a feature request for Next to build some of this functionality in: https://github.com/zeit/next.js/issues/706

@jamesmosier nice, it works with

config.module.rules.push({
        test    : /\.(js|jsx)$/,
        include : [path.resolve(__dirname, './node_modules/react-intl')],
        use     : [defaultLoaders.babel],
});

the app still broken but i think is a session cookies issue. 馃槄
thanks!

Was this page helpful?
0 / 5 - 0 ratings