i18next-scanner Typescript transform
npm install i18next-scanner-typescriptTypescript support for i18next-scanner
``bash`
yarn add -D i18next-scanner-typescript
`js
const typescriptTransform = require('i18next-scanner-typescript');
module.exports = {
options: {
func: {
// don't pass ts or tsx here!
extensions: ['.js', '.jsx'],
},
trans: {
// don't pass ts or tsx here!
extensions: ['.js', '.jsx'],
},
},
// your i18next-scanner config
// ...
transform: typescriptTransform(
// options
{
// default value for extensions
extensions: [".ts", ".tsx"],
// optional ts configuration
tsOptions: {
target: "es2017",
},
},
// optional custom transform function
function customTransform(outputText, file, enc, done) {
// do something custom with the transpiled outputText
parser.parseTransFromString(outputText);
parser.parseFuncFromString(outputText);
done();
},
),
};
``
Double check that you don't have TS extensions in the non-transform configuration