vueuse/head

the requested module does not provide an export named 'default'

Closed this issue · 1 comments

Hey guys, got the plugin to work on Vue3 + Nuxt3, but still having problems on the console.

Uncaught SyntaxError: The requested module '/_nuxt/plugins/usehead.client.ts' does not provide an export named 'default'

This error prevents me from building the app and I don't know what to do about it. Any help?

Using versions:
nuxt 3.0.0
@vueuse/head - 1.0.22

Here is my plugins/usehead.client.ts file:

import { createApp } from "vue";
import { createHead } from "@vueuse/head";
import App from "../App.vue";

const app = createApp(App);
const head = createHead();

app.use(head);

app.mount("#app");

And here is nuxt.config.ts:

export default defineNuxtConfig({
  modules: ["@nuxt/content"],
  css: ["~/assets/bootstrap/bootstrap.min.css"],
  vite: {
    optimizeDeps: {
      exclude: ["class-validator"],
    },
  },
  target: "static",
  nitro: {
    prerender: {
      routes: ["/sitemap.xml"],
    },
  },
  app: {
    head: {
      script: [
        {
          src: "/assets/bootstrap/bootstrap.min.js",
          type: "text/javascript",
        },
      ],
      htmlAttrs: {
        lang: "pt",
      },
      meta: [
        { charset: "utf-8" },
        { name: "viewport", content: "width=device-width, initial-scale=1" },
        { hid: "description", name: "description", content: "" },
        { name: "format-detection", content: "telephone=no" },
      ],
    },
  },
});

Just realized this comes by default in nuxt 3. No need to install anything.