Tangible Bytes

A Web Developer’s Blog

Vitest Partial Mock InertiaJs

I have a Laravel project using vite InertiaJS and React

A unit test calling the Head module from @inertiajs/react

Was triggering this error

Cannot read properties of undefined (reading 'createProvider')

For this test I don’t really care about the Head module - but didn’t want to try and mock the whole of inertia-react

Read more ...

Yarn, Vscode, and Typescript

The JavaScript ecosystem is a sea of choices and it seems to be all too easy to make an incompatible selection.

In my case I am using the Yarn package manager, the VSCode editor and TypeScript flavoured JS (I don’t think it really counts as a different language)

Every import statement was triggering an error in VScode

Cannot find module ’’ or its corresponding type declarations

Read more ...

Next.js Environment Variables

I’m running Next.js apps in production using Kubernetes - and I’ve inherited some setup that I didn’t fully understand so I’ve been investigating what is going on with environment variables.

My inherited system used a build per environment and bakes in configuration at that point.

I dislike this because …

Read more ...

Hugo and Webpack

Hugo - The world’s fastest framework for building websites is pretty awesome. It’s what I use to manage this site.

But much of the web development world has moved in the direction of JavaScript, npm, and Webpack.

So how can you run a Hugo website and manage the embedded JavaScript and CSS that are most commonly managed with npm and Webpack?

Read more ...