DenReg/jsx-html/babel-remove-ext.js
Fabian Stamm 1b2d85eeef
All checks were successful
continuous-integration/drone/push Build is passing
Adding hotfixes for packages
2020-10-14 02:56:11 +02:00

27 lines
780 B
JavaScript

'use strict';
var regExp = /\.(ts|tsx|js|jsx)$/i;
module.exports = function () {
return {
visitor: {
ImportDeclaration: function ImportDeclaration(path) {
var source = path.node.source;
if (!source.value.match(regExp)) {
return;
}
source.value = source.value.replace(regExp, '');
},
ExportDeclaration: function ExportDeclaration(path) {
var source = path.node.source;
if (source) {
if (!source.value.match(regExp)) {
return;
}
source.value = source.value.replace(regExp, '');
}
},
},
};
};