Skip to content

Commit

Permalink
fix(webpack): remove test attributes from build (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmcg committed Dec 2, 2021
1 parent 8cfb8d9 commit 7d82d66
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,29 @@ export default defineNuxtConfig({

// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
extend(config) {
extend(config, ctx) {
config.node = {
fs: 'empty',
encoding: 'empty',
}
const testAttributes = ['data-cy']
ctx.loaders.vue.compilerOptions = {
modules: [
{
preTransformNode(astEl) {
const { attrsMap, attrsList } = astEl
testAttributes.forEach((attribute) => {
if (attrsMap[attribute]) {
delete attrsMap[attribute]
const index = attrsList.findIndex((x) => x.name === attribute)
attrsList.splice(index, 1)
}
})
return astEl
},
},
],
}
},
babel: { compact: true },
},
Expand Down

0 comments on commit 7d82d66

Please sign in to comment.