gilbsgilbs / babel-plugin-i18next-extract

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

excludes doesn't seem to work #230

Closed iDVB closed 2 years ago

iDVB commented 2 years ago

Describe the bug Tried every number of glob patterns for excludes option and can't get anything to work. It always picks up on whatever is set in the CLI.

yarn run babel --config-file ./babel-extract.config.js -o tmp/chunk.js 'src/**/*.{js,jsx,ts,tsx}' && rm -rf tmp

How to reproduce

Babel configuration:

const { LOCALES, DEFAULT_LOCALE } = require('./languages')

process.env.NODE_ENV = 'test'

module.exports = {
  presets: ['babel-preset-gatsby'],
  plugins: [
    [
      'i18next-extract',
      {
        keySeparator: null,
        nsSeparator: null,
        locales: Object.keys(LOCALES),
        keyAsDefaultValue: [DEFAULT_LOCALE],
        useI18nextDefaultValue: [DEFAULT_LOCALE],
        discardOldKeys: true,
        defaultNS: 'common',
        outputPath: 'locales/{{locale}}/{{ns}}.json',
        customTransComponents: [['gatsby-plugin-react-i18next', 'Trans']],
        excludes: ['**/*'],
      },
    ],
  ],
}

Expected behavior It should ignore processing on the files that follow given glob pattern.

What actually happens

all files specified in the CLI command are processed.

Your environment

gilbsgilbs commented 2 years ago

Sorry, excludes are only available in 0.9.0-rc and 0.9.0-rc.1. I need to make a final release.

Moreover, they are regexp. Not globs.