Closed philipp-tailor closed 1 month ago
Same here. I found this commit in the Vuetify repo that fixed the same issue there. I think we need to add something like that in this file:
return { code: output, map: null };
Workaround
import removeAttr from 'remove-attr';
const removeAttrPlugin = removeAttr({
extensions: ['vue'],
attributes: ['data-testid'],
});
export default {
...removeAttrPlugin,
transform(code, id) {
const result = removeAttrPlugin.transform(code, id);
return {
code: result,
map: null,
};
},
};
And vite.config
import removeAttr from './vite-remove-attr-plugin';
export default {
...,
plugins: [removeAttr]
}
@philipp-tailor I checked with vite@5.0.12 and vue@3.4.29 but I could not see same error. Can you provide reproducible example
For context: I'm talking about a Vue app built with Vite
5.0.12
, with the following plugin configuration:When building, I'm getting the following error message - seemingly repeated for every single affected
.vue
file:(remove-attributes plugin) Sourcemap is likely to be incorrect: a plugin (remove-attributes) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
The sourcemaps of all files, even JS files which aren't even affected by the plugin look as follows:
{"version":3,"file":"myFile.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
When I uncomment
remove-attr
, valid sourcemaps are being generated.