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 build

Error: "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:

  1. File extension (should be .tsx for JSX)
  2. React import
  3. Valid JSX syntax

Error: "Expected"

Unexpected token
  --> app/routes/index.tsx:5:3

Solution:

// Check for missing or extra braces
// ✓ Correct
return (
  <div>Hello</div>
);

// ✗ Incorrect - missing >
return (
  <div>Hello</div>
);

Common Error Messages

ErrorCauseSolution
Module not foundMissing dependencybun add <pkg>
Type errorType mismatchCheck types
Parse errorInvalid syntaxCheck file
Build failedMultiple causesCheck detailed error
Circular dependencyImport cycleBreak cycle

Debug Commands

Run with verbose output

bun build --verbose 2>&1 | head -50

Check TypeScript

bunx tsc --noEmit

Run 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:

On this page