Back to blog
EngineeringOct 18, 2026· min read

When Your Build Tool Isn't Actually Yours

We were importing @vitejs/plugin-react without declaring it. It worked—until the day it wouldn't. Here's why we fixed it before finding out the hard way.

This week we shipped a one-line change to package.json: explicitly declaring @vitejs/plugin-react as a dependency. The diff is boring. The risk we eliminated isn't.

The Problem: Transitive Dependencies Are Borrowed, Not Owned

Our vite.config.ts imported @vitejs/plugin-react. We used it in every dev server session and every build. But we never declared it in package.json.

It worked because some other package—probably a scaffolding tool or a meta-package—happened to install it. We were borrowing someone else's dependency. The build didn't break because the module was physically present in node_modules. But we had no contract guaranteeing it would stay there.

When that upstream package refactors its own dependencies—or when we remove it entirely—our build breaks. Not because we changed anything. Because someone else did.

The Catch: TDD Audit Found It First

We added a new audit test: dependency-declarations.audit.test.ts. It scans our config files, extracts every import statement, and verifies that the imported package is declared in package.json.

The test failed. @vitejs/plugin-react was imported but not declared. We fixed it by adding one line to dependencies and running npm install to lock the version.

No production incident. No emergency Saturday deploy. No debugging session wondering why CI suddenly can't resolve a module that worked yesterday. We caught it in the audit, not in the wild.

Why It Matters

Undeclared dependencies are a supply chain risk. You're coupling your build to someone else's dependency tree without a contract. When they change, you break.

This is the same class of problem that breaks production deploys when a transitive dependency unpublishes itself from npm. The difference: we can prevent it with a 10-line test.

Declaring what you import isn't paranoia. It's ownership. If we're running the code, we declare the dependency. If we declare it, we control the version. If we control the version, we control when it changes.

What's Next

The dependency-declarations audit test now runs on every commit. It scans vite.config.ts and any other config files we add, ensuring every import has a corresponding package.json entry.

We're applying the same pattern to other repos. If you import it, declare it. If you declare it, lock it. If you lock it, own the upgrade cycle.

The boring commits prevent the interesting outages.