1- import { resolve } from 'pathe'
21import type { MetaObject } from '@nuxt/schema'
3- import { defineNuxtModule , isNuxt2 , resolvePath , useLogger } from '@nuxt/kit'
2+ import { defineNuxtModule , isNuxtMajorVersion , resolvePath , useLogger } from '@nuxt/kit'
3+ import { resolve } from 'pathe'
44import { constructURL , download , isValidURL , parse , merge , type DownloadOptions , type GoogleFonts } from 'google-fonts-helper'
55import { name , version } from '../package.json'
66
@@ -184,7 +184,7 @@ export default defineNuxtModule<ModuleOptions>({
184184 return
185185 }
186186
187- if ( isNuxt2 ( ) ) {
187+ if ( isNuxtMajorVersion ( 2 , nuxt ) ) {
188188 // JS to inject CSS
189189 head . script . push ( {
190190 key : 'gf-script' ,
@@ -212,7 +212,7 @@ export default defineNuxtModule<ModuleOptions>({
212212 // JS to inject CSS
213213 head . script . unshift ( {
214214 key : 'gf-script' ,
215- children : `(function(){
215+ innerHTML : `(function(){
216216 var h=document.querySelector("head");
217217 var m=h.querySelector('meta[name="head:count"]');
218218 if(m){m.setAttribute('content',Number(m.getAttribute('content'))+1);}
@@ -223,7 +223,7 @@ export default defineNuxtModule<ModuleOptions>({
223223
224224 // no-JS fallback
225225 head . noscript . push ( {
226- children : `<link rel="stylesheet" href="${ url } ">` ,
226+ innerHTML : `<link rel="stylesheet" href="${ url } ">` ,
227227 tagPosition : 'bodyOpen' ,
228228 } )
229229 } ,
0 commit comments