Asset and codegen imports resolve
Why it matters
A missing asset or codegen output fails the bundler the moment it tries to inline the file, so import logo from './logo.svg' with no logo.svg on disk hard-stops the build. AI tools commonly write import statements for images, stylesheets, and Prisma/GraphQL-Codegen outputs that were never created — the codegen case is especially subtle because the file exists locally after npm run dev but the CI step skips the generator and fails. Either way the deploy breaks.
Severity rationale
High because unresolved asset or codegen imports break the build in CI even when the local dev server runs clean.
Remediation
For each flagged asset, either create the file at the expected location or remove the import if it was hallucinated. For codegen outputs, wire the generator into the install and build lifecycle in package.json so CI produces the same files your dev machine does:
{
"scripts": {
"postinstall": "prisma generate",
"build": "prisma generate && next build"
}
}
Detection
-
ID:
asset-imports-resolve -
Severity:
high -
What to look for: Walk source files for imports with these extension patterns:
.svg,.png,.jpg,.jpeg,.webp,.avif,.gif,.ico,.css,.scss,.sass,.less,.module.css,.json,.txt,.md,.mdx,.yaml,.yml,.toml,.glb,.gltf,.wasm. Also look for codegen-style imports matching/generated/,/__generated__/,.generated.,.gen.. For each, resolve relative to the importing file (or via path alias) and verify the file exists. For codegen imports that don't currently exist, checkpackage.jsonscriptsfor apostinstall,prebuild,codegen,generate, orpreparescript that produces files matching the pattern (e.g., aprisma generatescript produces files undernode_modules/.prisma/client/, agraphql-codegenscript produces files in the configured output directory). Count all asset/codegen imports inspected, total resolved-on-disk, total resolved-via-codegen-step, total unresolved. -
Pass criteria: 100% of asset and codegen imports resolve to an existing file OR are produced by a declared codegen step. Report: "X asset imports inspected, Y resolved on disk, Z produced by codegen, 0 unresolved."
-
Fail criteria: At least 1 asset or codegen import does not resolve to a file AND is not produced by any declared codegen step.
-
Skip (N/A) when: No source files import any asset or codegen file (count of asset imports is 0).
-
Report even on pass: Report all three counts. Example: "32 asset imports inspected, 30 resolved on disk, 2 produced by codegen ('prisma generate'), 0 unresolved."
-
Detail on fail:
"4 unresolved asset imports: './logo.svg' in src/components/Header.tsx (file missing), '@/styles/globals.css' in src/app/layout.tsx (resolved path src/styles/globals.css does not exist)" -
Remediation: AI commonly imports asset files (logos, images, stylesheets) that were never created. Each unresolved asset import will fail at build time. Fix each one:
# Find the missing file's expected location # Either create the file (if intentional) or remove the import (if not)For codegen-produced files, ensure the codegen script is in
package.jsonscriptsand is invoked before the build:{ "scripts": { "postinstall": "prisma generate", "build": "next build" } }
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-hallucinations·automated