{"id":26618,"library":"vue-remove-attributes","title":"vue-remove-attributes","description":"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.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/emensch/vue-remove-attributes","tags":["javascript","vue","template","compiler","webpack","module","HTML","attribute","remove","typescript"],"install":[{"cmd":"npm install vue-remove-attributes","lang":"bash","label":"npm"},{"cmd":"yarn add vue-remove-attributes","lang":"bash","label":"yarn"},{"cmd":"pnpm add vue-remove-attributes","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for the compiler module; must match the Vue version used.","package":"vue-template-compiler","optional":false}],"imports":[{"note":"The package exports a single default function; named import will be undefined.","wrong":"import { createAttributeRemover } from 'vue-remove-attributes'","symbol":"default (createAttributeRemover)","correct":"import createAttributeRemover from 'vue-remove-attributes'"},{"note":"CommonJS require returns the default export directly, not an object.","wrong":"const { createAttributeRemover } = require('vue-remove-attributes')","symbol":"default (CommonJS)","correct":"const createAttributeRemover = require('vue-remove-attributes')"},{"note":"The package does not export a named type; use import type for the default export.","wrong":"import { CreateAttributeRemover } from 'vue-remove-attributes'","symbol":"TypeScript type","correct":"import type CreateAttributeRemover from 'vue-remove-attributes'"}],"quickstart":{"code":"// webpack.config.js\nconst createAttributeRemover = require('vue-remove-attributes');\n\nmodule.exports = {\n  entry: './src/main.js',\n  module: {\n    rules: [\n      {\n        test: /\\.vue$/,\n        use: {\n          loader: 'vue-loader',\n          options: {\n            compilerOptions: {\n              modules: [\n                createAttributeRemover('data-testid')\n              ]\n            }\n          }\n        }\n      }\n    ]\n  }\n};","lang":"javascript","description":"Shows how to require the module and configure vue-loader to remove 'data-testid' attributes from all components."},"warnings":[{"fix":"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$/.","message":"Attributes like :data-testid and v-bind:data-testid are treated as separate from data-testid; they will not be removed unless explicitly matched.","severity":"gotcha","affected_versions":"<=1.0.3"},{"fix":"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.","message":"The package depends on vue-template-compiler which is deprecated for Vue 3 in favor of @vue/compiler-sfc.","severity":"deprecated","affected_versions":"<=1.0.3"},{"fix":"Use Node.js 10 or higher.","message":"Version 1.0.0 dropped support for Node.js < 10.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use default import: import createAttributeRemover from 'vue-remove-attributes' or const createAttributeRemover = require('vue-remove-attributes').","cause":"Named import instead of default import.","error":"TypeError: createAttributeRemover is not a function"},{"fix":"Ensure you are passing options to vue-loader: { loader: 'vue-loader', options: { compilerOptions: { modules: [...] } } }.","cause":"Misconfiguration of vue-loader options.","error":"Cannot read property 'compilerOptions' of undefined"},{"fix":"Install vue-template-compiler as a dev dependency: npm install -D vue-template-compiler.","cause":"Missing peer dependency.","error":"Module not found: Can't resolve 'vue-template-compiler'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}