gilbsgilbs / babel-plugin-i18next-extract

Babel plugin that statically extracts i18next and react-i18next translation keys.
https://i18next-extract.netlify.com
MIT License
161 stars 37 forks source link

Last plugin version fails compiling #176

Closed carloszv closed 4 years ago

carloszv commented 4 years ago

Describe the bug

Couldn't compile my project with the last plugin version

How to reproduce

yarn run build

Babel configuration:

{
  "presets": ["next/babel"],
  "plugins": [
    ["styled-components", { "ssr": true }],
    [
      "i18next-extract",
      {
        "locales": ["es"],
        "keySeparator": null,
        "nsSeparator": null,
        "outputPath": "src/locales/{{locale}}.json"
      }
    ]
  ]
}

Reproduction:

Provide a code snippet that produce the unexpected result.
Try to isolate the bug and make this snippet as simple, concise and self-explanatory as possible.

Expected behavior

What actually happens

info - Creating an optimized production build Failed to compile.

./node_modules/next/dist/client/next.js E:\Workspace\Proyectos\react-nextjs-ecommerce-starter\node_modules\babel-plugin-i18next-extract\index.js:426 cache.originalTranslationFiles[filePath] = deepmerge__default['default'](cache.originalTranslationFiles[filePath] ?? {}, loadTranslationFile(exporter, config, filePath), { ^

SyntaxError: Unexpected token '?'

Your environment

Additional context

Previous version works perfectlly

gilbsgilbs commented 4 years ago

Thanks for the report. Should be fixed in 0.8.2 available on NPM.