vue-remove-attributes 1.0.3 is a Vue template compiler module that removes unwanted attributes (e.g., data-testid) from Vue single-file component templates at build time. It integrates with vue-loader via compilerOptions and supports matching attributes by string, array, or regex. Heavily dependent on vue-template-compiler (or @vue/compiler-sfc for Vue 3), it is best suited for Vue 2 projects using Webpack, similar to babel-plugin-jsx-remove-data-test-id but for Vue templates. Currently stable with low release cadence and limited community adoption.
npm install vue-remove-attributesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to require the module and configure vue-loader to remove 'data-testid' attributes from all components.
Use an array or regex that matches all permutations: createAttributeRemover(['data-testid', ':data-testid', 'v-bind:data-testid']) or a regex like /^:?v-bind:?data-testid$/.
For Vue 3, use @vue/compiler-sfc's compileTemplate option or migrate to a different solution like babel-plugin-jsx-remove-data-test-id for JSX templates.
Use Node.js 10 or higher.
Use default import: import createAttributeRemover from 'vue-remove-attributes' or const createAttributeRemover = require('vue-remove-attributes').Ensure you are passing options to vue-loader: { loader: 'vue-loader', options: { compilerOptions: { modules: [...] } } }.Install vue-template-compiler as a dev dependency: npm install -D vue-template-compiler.