Category: Nuxt3
-
Unit tests with Nuxt 3 and Vitest
We found these to be the best packages for testing with Nuxt 3. It takes car of a lot of config you would have to do manually with just Vitest. Especially auto imports. Just for example – do not use! This is the full setup via defineConfig and Vite — import { defineConfig } from…
-
Deployment environment variables Nuxt3 with bitbucket & docker
Had quite a few issues setting this up with our Bitbucket deployments. Most overlooked fact was needing to prefix variables remotely with NUXT_ for private variables. And NUXT_PUBLIC_ for public variables. For example an ENV variable needs — NUXT_PUBLIC_FLAG_BASE_URL & accessed via process.env.FLAG_BASE_URL or process.env.flagBaseUrl This also applies to Netlify, Vercel etc. Environment config (Bitbucket…
-
Environment variables in Nuxt3
There are a few way to access environment variables in Nuxt3. How depends on where you are trying to access them. Middleware & Plugins Pages, Components & Layouts Within the <script setup> block. Store files Has to be called inside an action or getter Service files (GRPC) This seems trickier on a server or deployment…
-
Using Nuxt3 plugins
Some small difference with Nuxt3’s use of plugins. First of all we need to use defineNuxtPlugin(). The plugins are already registered globally for use. The user object looks like —