Skip to content

Commit

Permalink
fix: resolve raw options
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Feb 28, 2024
1 parent c1af4fd commit 5850744
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export default defineNuxtConfig({
modules: ['../src/module.ts'],

gtag: {
id: 'G-ZZZZZZZZZZ',
enabled: false,
id: 'G-ZZZZZZZZZZ',
initCommands: [
// Setup up consent mode
['consent', 'default', {
Expand Down
5 changes: 3 additions & 2 deletions src/runtime/utils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import type { ModuleOptions } from '../module'
import type { GoogleTagOptions } from './types'
import { toRaw } from '#imports'

export function resolveTags(options: Required<ModuleOptions>) {
// Normalize tags
const tags: GoogleTagOptions[] = [...options.tags].filter(Boolean)
const tags: GoogleTagOptions[] = toRaw(options).tags.filter(Boolean)
.map(i => typeof i === 'string' ? { id: i } : i)

if (options.id) {
const { id, config, initCommands } = options
const { id, config, initCommands } = toRaw(options)
tags.unshift({ id, config, initCommands })
}

Expand Down

0 comments on commit 5850744

Please sign in to comment.