vernaillen / wpnuxt-module

https://wpnuxt.com
7 stars 1 forks source link

Type Error when using when enabling WPNuxt generateComposables option #140

Open yosefeliezrie opened 1 week ago

yosefeliezrie commented 1 week ago

Issue

When you add the generateComposables: {enabled: true} to 'wpNuxt' section for your nuxt.config.ts you get the following error

Object literal may only specify known properties, and 'enabled' does not exist in type '{ prefix: string; async: boolean; }'.ts(2353)

Currently using WPNuxt

Current package.json

{
  "name": "wpnuxt-demo",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "nuxt dev",
    "build": "nuxt build",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare",
    "start": "nuxt start"
  },
  "devDependencies": {
    "@iconify-json/mdi": "^1.1.67",
    "@nuxt/image": "^1.7.0",
    "@nuxt/ui-pro": "^1.3.0",
    "@nuxtjs/plausible": "^1.0.0",
    "@vernaillen/wpnuxt": "0.5.0-edge.0",
    "@vueuse/core": "^10.11.0",
    "nuxt": "^3.12.2",
    "nuxt-time": "^0.1.3"
  },
  "dependencies": {
    "vue-easy-lightbox": "^1.19.0",
    "vue-json-pretty": "^2.4.0"
  },
  "packageManager": "pnpm@9.4.0+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a"
}

Current nuxt.config.ts (Based on Current Version of WPNuxt-Demo Repo

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  experimental: {
      viewTransition: true
  },

  extends: ['@nuxt/ui-pro'],

  modules: [
      '@nuxt/image',
      '@nuxt/ui',
      '@nuxtjs/plausible',
      '@vernaillen/wpnuxt',
      'nuxt-time',
  ],

  future: {
    compatibilityVersion: 4
  },

   // https://wpnuxt.com/getting-started/installation
  wpNuxt: {
      wordpressUrl: 'https://wordpress.wpnuxt.com',
      frontendUrl: 'https://demo.wpnuxt.com',
      defaultMenuName: 'main',
      blocks: true,
      showBlockInfo: false,
      enableCache: true,
      staging: false,
      logLevel: 4,
      downloadSchema: true,
      generateComposables: {
        enabled: true,
      }
  },

  css: [
      'vue-json-pretty/lib/styles.css'
  ],

  image: {
      provider: 'twicpics',
      twicpics: {
          baseURL: 'https://vernaillen.twic.pics/wpnuxt-demo'
      }
  },

  colorMode: {
    preference: 'dark'
  },

  ui: {
      icons: ['mdi']
  },

  routeRules:  {
      '/**': {
          prerender: true,
      }
  },

  plausible: {
    apiHost: 'https://demo.wpnuxt.com/plio'
  },

  devtools: {
    enabled: true
  }
})
vernaillen commented 1 week ago

Can you try if you still get the error when you use wpnuxt 0.5.1? It's a patch version which enables the generated composables by default and should also fix the type error.