Troubleshooting
Build Errors
Debugging linting, TypeScript, bundling, and compilation errors in Manic.
Build Errors
TL;DR
Solutions for common build errors including linting failures, TypeScript errors, and bundling issues.
Linting Errors
oxlint Errors
Error: "Import not resolved"
Problem: Module cannot be found.
Solution:
# Install missing dependencies
bun add <package-name>
# Or check import path
// Check: import { x } from 'manicjs' vs 'manicjs/router'Error: "Unused variable"
Solution:
// Either use the variable
const value = usedVariable;
// Or add underscore prefix to indicate intentional non-use
const _unused = something;TypeScript Errors
Error: "Cannot find module"
Solution:
# Add types
bun add -d @types/<package>
# Or create type declaration
// app/types.d.ts
declare module 'some-package';Error: "Property does not exist"
Solution:
// Extend the type
declare module 'manicjs' {
interfaceRouteParams {
id: string;
}
}Error: "Type instantiation is excessively deep"
Solution:
// Simplify complex types
// Or use any with comment
// @ts-expect-error - complex type
const value: any = complexValue;Bundling Errors
Error: "Build failed"
Solution:
# Check full error message
bun build 2>&1
# Clear cache and rebuild
rm -rf .manic
bun buildError: "Chunk too large"
Solution:
// Enable code splitting
// Use dynamic imports
const Heavy = import('./HeavyComponent');Error: "Dynamic import not supported"
Solution:
// Ensure target supports dynamic import
// manic.config.ts
export default defineConfig({
build: {
target: 'es2022',
},
});Compilation Errors
Error: "Unexpected token"
Check:
- File extension (should be .tsx for JSX)
- React import
- Valid JSX syntax
Error: "Expected"
Unexpected token
--> app/routes/index.tsx:5:3Solution:
// Check for missing or extra braces
// ✓ Correct
return (
<div>Hello</div>
);
// ✗ Incorrect - missing >
return (
<div>Hello</div>
);Common Error Messages
| Error | Cause | Solution |
|---|---|---|
Module not found | Missing dependency | bun add <pkg> |
Type error | Type mismatch | Check types |
Parse error | Invalid syntax | Check file |
Build failed | Multiple causes | Check detailed error |
Circular dependency | Import cycle | Break cycle |
Debug Commands
Run with verbose output
bun build --verbose 2>&1 | head -50Check TypeScript
bunx tsc --noEmitRun Linter
bunx oxlint .Best Practices
Check the full error message - it usually points to the exact location.
Restart the dev server after installing new dependencies.
Use --verbose for detailed build output.
See also: