js-lingui: babel-plugin-lingui-extract-messages doesn't work when targeting IE 11

If I add the browser ie 11 to my babel-preset-env config, then I get some errors if I try to build my application:

[info] Module build failed: TypeError: ...: Cannot read property 'reduce' of undefined
[info]     at collectMessage (...\node_modules\babel-plugin-lingui-extract-messages\lib\index.js:24:27)

I’m not sure if this has to do with js-lingui or if it’s an issue from another component.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (13 by maintainers)

Most upvoted comments

I use flow also in react components, so your proposal won’t work. I’ve created a i18n env in babel which adds the necessary presets and plugins.

"env": {
  "i18n": {
    "plugins": [
      "transform-class-properties",
      "transform-es2015-classes",
      "transform-object-rest-spread",
      "syntax-dynamic-import"
    ],
    "presets": ["react"]
  }
}

Then I can execute cross-env BABEL_ENV=i18n lingui extract.

I’ll ask in the Neutrino.js Slack Channel if there is a way to execute third party commands with the generated babel configuration.