tkoamom
Nuxt 3 config head script set data attribute
Help me please. I have strange isue with setting data-attributes correctly in nuxt.config.ts
I need to have script like this in head block
<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="00b06111-8111-4169-a514-5b3b6e111111" data-blockingmode="auto" type="text/javascript"></script>
and I try to make it this way in config
app: {
head: {
script: [
{
id: 'Cookiebot',
src: 'https://consent.cookiebot.com/uc.js',
'data-cbid': '00b0646b-80ee-4169-a514-5b3b6e297aab',
'data-blockingmode': 'auto',
type: 'text/javascript',
},
]
}
}
the problrm is with these two lines as they cause error
[nuxt] error caught during app initialization TypeError: Cannot read properties of undefined (reading 'app')
9 replies