This transformer allows you to remove one or many jsx attributes during compile time.
It can be useful if you want to remove e.g. data-testid
attribute.
You could use it with webpack and ts-loader like that:
- First import transformer e.g.
const { removeJsxAttributesTransformer } = require('typescript-transformer-jsx-remove-attributes');
- After that, modify your
ts-loader
configuration:
{
test: /\.(ts|tsx)$/,
loader: 'ts-loader',
options: {
getCustomTransformers: () => ({ before: [removeJsxAttributesTransformer(['data-testid', /* any other attribute */])] })
}
}