question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi, I’m new to the vue world and I’m trying to use nuxt3@latest + bootstrap-vue-3 (0.0.5) to generate static pages but I haven’t found any documentation on how to get started

After some research I took the base example page and added <b-container/> around it as follows:

<script lang="ts" setup>
    const counter = useState('counter', () => Math.round(Math.random() * 1000))
</script>

<template>
  <div>
    <b-container>
        Counter: {{ counter }}
        <button @click="counter++">+</button>
        <button @click="counter--">-</button>
    </b-container>
  </div>
</template>

and created a plugin based on what I saw on the README

import { defineNuxtPlugin } from '#app'

import BootstrapVue3 from 'bootstrap-vue-3'

export default defineNuxtPlugin((nuxtApp) => {
    nuxtApp.vueApp.use(BootstrapVue3)
})

unfortunately, it crashes with something I don’t really understand

document is not defined

any pointer or suggestion? I’m pretty lost atm

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:36 (15 by maintainers)

github_iconTop GitHub Comments

3reactions
wobsorianocommented, Mar 13, 2022

This is my working setup for nuxt3:

// nuxt.config.ts
import { defineNuxtConfig } from "nuxt3"

export default defineNuxtConfig({
  css: [
    "bootstrap/dist/css/bootstrap.css",
    "bootstrap-vue-3/dist/bootstrap-vue-3.css",
  ],
})
// plugins/bootstrap.client.ts
import BootstrapVue3 from "bootstrap-vue-3"

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(BootstrapVue3)
})
<template>
  <div>
    <ClientOnly>
      <b-accordion>
        <b-accordion-item title="Accordion Item #1" visible>
          Accordion 1
        </b-accordion-item>
        <b-accordion-item title="Accordion Item #2">
          Accordion 2
        </b-accordion-item>
        <b-accordion-item title="Accordion Item #3">
          Accordion 3
        </b-accordion-item>
      </b-accordion>
    </ClientOnly>
  </div>
</template>

Just wrap the bootstrap component with the <ClientOnly /> component provided by nuxt 3 whenever you get a Invalid value used as weak map key error

2reactions
reqwirecommented, May 26, 2022

@edwh it seems the ssr fixes were postponed until 5.3.

Understandable too - the creator had a heart attack.

Read more comments on GitHub >

github_iconTop Results From Across the Web

viandwi24/nuxt3-awesome-starter: a Nuxt 3 template ... - GitHub
a Nuxt 3 starter template or boilerplate with a lot of useful features. and integrated with TailwindCSS 3. This template was built to...
Read more >
nuxt3-awesome-starter - CodeSandbox
viandwi24/nuxt3-awesome-starter. Environmentnuxt. This sandbox is in sync with main on GitHub. You have to fork to make changes
Read more >
Nuxt 3 Awesome Starter
hello, welcome to Nuxt 3 Awesome Starter! learn more · home Nuxt 3 Awesome Starter · getting started · blank · test ·...
Read more >
start-nuxt3 - npm
The fast and easy way to start a Nuxt3 project. Latest version: 0.2.1, last published: 14 days ago. Start using start-nuxt3 in your...
Read more >
Xiaoluoboding - Nuxt3 Starter - StackBlitz
A Better Nuxt 3 starter template. ## Preview. <div>. <a href="https://stackblitz.com/github/. xiaoluoboding/nuxt3-starter" rel="nofollow".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found