Stringify-jsx plugin for babel. Read more about babel plugins or use stringify-jsx directly.
npm i --save-dev babel-plugin-transform-stringify-jsx
Inline:
const babel = require('@babel/core');
babel.transform('code', { plugins: [['transform-stringify-jsx', { /* stringify-jsx options */}]], parserOpts: { plugins: ['jsx']} });
.babelrc:
{
"parserOpts": {
"plugins": ["jsx"]
},
"plugins": [["transform-stringify-jsx", { /* stringify-jsx options */ }]]
}