Next.js Discord

Discord Forum

Paths in turbopack tsconfig

Unanswered
Little yellow ant posted this in #help-forum
Open in Discord
Little yellow antOP
I'm trying to get paths to work but seems like no matter what I do it fails to compile. In the editor everything looks fine and the paths are working but when I'm running it it says it can't be resolved.

../../packages/ui/src/components/text-editor/editor/Editor.tsx:27:0
Module not found: Can't resolve 'lib/utils'
> 27 | import { cn } from "lib/utils";

// packages/ui/tsconfig.json
{
  "extends": "@repo/typescript-config/react-library.json",
  "compilerOptions": {
    "baseUrl": "./src",
    "paths": {
      "lib/*": ["lib/*"],
    },
  },
  "include": ["src"],
  "exclude": ["node_modules"],
}

// @repo/typescript-config/react-library.json
{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "React Library",
  "extends": "./base.json",
  "compilerOptions": {
    "lib": ["ES2015", "DOM"],
    "module": "ESNext",
    "target": "ES6",
    "jsx": "react-jsx",
    "noEmit": true,
  }
}

// @repo/typescript-config/base.json
{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Default",
  "compilerOptions": {
    "composite": false,
    "declaration": true,
    "declarationMap": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "allowImportingTsExtensions": true,
    "noEmit": true,
    "inlineSources": false,
    "isolatedModules": true,
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "preserveWatchOutput": true,
    "skipLibCheck": true,
    "strict": true,
    "strictNullChecks": true,
    "noImplicitAny": true
  },
  "exclude": ["node_modules"]
}

0 Replies