Remove data-test attriubutes in non-dev env

This commit is contained in:
mattwr18 2019-12-04 11:56:52 +01:00
parent faefe75fe6
commit 58835947ad

View File

@ -272,6 +272,26 @@ export default {
},
},
})
const tagAttributesForTesting = ['data-test', ':data-test', 'v-bind:data-test']
ctx.loaders.vue.compilerOptions = {
modules: [
{
preTransformNode(astEl) {
if (!ctx.isDev) {
const { attrsMap, attrsList } = astEl
tagAttributesForTesting.forEach(attribute => {
if (attrsMap[attribute]) {
delete attrsMap[attribute]
const index = attrsList.findIndex(attr => attr.name === attribute)
attrsList.splice(index, 1)
}
})
}
return astEl
},
},
],
}
},
},
}