I have a JavaScript that should be added to the header if a specific env-variable
is set.
When I print the content of process.env
, there seems to be none of my envs
.
Here some code:
export default defineNuxtConfig({
runtimeConfig: {
public: {
includeInHeader: true
...
app: {
head:
process.env.INCLUDE_IN_HEADER
? {
script: [{ src: '/scripts/myJsFile.js' }],
}
: undefined
},
How can I include a js-file
to the header if a certain env
is set?